mirror of
https://github.com/hanzoai/ProjectTinySamples.git
synced 2026-09-24 00:01:34 +00:00
24 lines
636 B
C#
24 lines
636 B
C#
using Unity.Entities;
|
|
using Unity.Tiny.Rendering;
|
|
using Unity.Mathematics;
|
|
|
|
namespace BlendShapeDemo
|
|
{
|
|
/// <summary>
|
|
/// Convert screen point to world point
|
|
/// </summary>
|
|
|
|
public static class ScreenToWorldSystem
|
|
{
|
|
// Camera distance
|
|
private const float nearClip = 6.5f;
|
|
|
|
public static float3 ScreenPointToWorldPoint(World world, float screenPoint)
|
|
{
|
|
var screenToWorldSystem = world.GetExistingSystem<ScreenToWorld>();
|
|
var worldPoint = screenToWorldSystem.ScreenSpaceToWorldSpacePos(screenPoint, nearClip);
|
|
return worldPoint;
|
|
}
|
|
}
|
|
}
|