/// <summary>
/// 设置对象的前方向
/// </summary>
/// <param name="vForward"></param>
public void SetForward(Vector3 vForward)
{
Root.transform.forward = vForward;
}
/// <summary>
/// 获得前置向量
/// </summary>
/// <returns></returns>
public Vector3 GetForward()
{
if (Root != null)
return Root.transform.forward;
return Vector3.forward;
}
public override void Update()
{
base.Update();
Vector3 dir = (m_TargetPos - Position).normalized;
dir.y = 0;
dir.Normalize();
Vector3 m_TempForward = Vector3.Slerp(GetForward(), dir, 180);
SetForward(m_TempForward);
}