您最多选择25个主题
主题必须以中文或者字母或数字开头,可以包含连字符 (-),并且长度不得超过35个字符
27 行
913 B
27 行
913 B
using Unity.Burst;
|
|
using Unity.Entities;
|
|
using Unity.Mathematics;
|
|
using Unity.Transforms;
|
|
|
|
namespace Unity.MegaCity.CameraManagement
|
|
{
|
|
/// <summary>
|
|
/// Job to update the camera target position and rotation
|
|
/// </summary>
|
|
[BurstCompile]
|
|
public partial struct UpdateCameraTargetJob : IJobEntity
|
|
{
|
|
public LocalToWorld LocalToWorld;
|
|
public float DeltaTime;
|
|
|
|
public void Execute(
|
|
ref LocalTransform transform,
|
|
in PlayerHybridCameraTarget playerHybridCameraTarget)
|
|
{
|
|
transform.Position = math.lerp(transform.Position, LocalToWorld.Position,
|
|
DeltaTime * playerHybridCameraTarget.TargetFollowDamping);
|
|
transform.Rotation = math.slerp(transform.Rotation, LocalToWorld.Rotation,
|
|
DeltaTime * playerHybridCameraTarget.TargetFollowDamping);
|
|
}
|
|
}
|
|
}
|