Megacity demo game for UOS
您最多选择25个主题 主题必须以中文或者字母或数字开头,可以包含连字符 (-),并且长度不得超过35个字符

35 行
1.2 KiB

using Unity.Burst;
using Unity.Entities;
using Unity.Mathematics;
using Unity.MegaCity.Gameplay;
using Unity.Transforms;
namespace Unity.MegaCity.CameraManagement
{
/// <summary>
/// Reads the transform data copied from the dolly cart game object and moves the player accordingly
/// </summary>
[BurstCompile]
internal partial struct DollyTrackPlayerUpdaterJob : IJobEntity
{
public float3 DollyTrackPosition;
public quaternion DollyTrackRotation;
public float DeltaTime;
public void Execute(
ref LocalTransform localTransform,
in PlayerVehicleSettings playerVehicleSettings)
{
if (math.distancesq(localTransform.Position, DollyTrackPosition) > playerVehicleSettings.TargetSqLerpThreshold)
{
localTransform.Position = DollyTrackPosition;
}
localTransform.Position = math.lerp(localTransform.Position, DollyTrackPosition,
DeltaTime * playerVehicleSettings.TargetFollowDamping);
localTransform.Rotation = math.slerp(localTransform.Rotation, DollyTrackRotation,
DeltaTime * playerVehicleSettings.TargetFollowDamping);
}
}
}