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