您最多选择25个主题
主题必须以中文或者字母或数字开头,可以包含连字符 (-),并且长度不得超过35个字符
22 行
668 B
22 行
668 B
using UnityEngine;
|
|
|
|
namespace GameplayIngredients.Rigs
|
|
{
|
|
public class LookAtRig : Rig
|
|
{
|
|
public override int defaultPriority => 0;
|
|
public override UpdateMode defaultUpdateMode => UpdateMode.LateUpdate;
|
|
|
|
public Transform LookAtTarget;
|
|
public Space UpVectorSpace = Space.World;
|
|
public Vector3 UpVector = Vector3.up;
|
|
|
|
public override void UpdateRig(float deltaTime)
|
|
{
|
|
if (LookAtTarget != null)
|
|
{
|
|
transform.LookAt(LookAtTarget, UpVectorSpace == Space.Self? transform.InverseTransformDirection(UpVector).normalized: UpVector.normalized);
|
|
}
|
|
}
|
|
}
|
|
}
|