/// <summary> /// 直接转,相当于LookAt基本不用。 /// </summary> /// <param name="target"></param> protected void TurnTo(Vector3 target) { var dirWorld = target - this.ownerEntity.position; float angle = Math_F.TwoDirYAngle(this.ownerEntity.forward, dirWorld.normalized); if (Vector3.Cross(dirWorld, this.ownerEntity.forward).y >= 0) { this.ownerEntity.Rotate(new Vector3(0, -angle, 0), Space.Self); return; } this.ownerEntity.Rotate(new Vector3(0, angle, 0), Space.Self); }