C#Unity旋转/四元数

时间:2017-01-26 23:54:19

标签: unity3d quaternions

嗨,我有一段时间没遇到问题...而且我不知道怎么回事......

Click to see 我得到了简单的航路点系统,并且每个Waypoint都存储在List<变换>,因此航点可以存储位置和旋转。

我的问题是WaypointFollower可以随时使用

进行LookForward
Quaternion lookRot = Quaternion.LookRotation(pathContainer.WayPoints[currentID].transform.position - transform.position);
transform.rotation = Quaternion.Slerp(transform.rotation, lookRot, Time.smoothDeltaTime * 5f)

或者可以进行下一个航路点存储的轮换

Quaternion destRot = pathContainer.WayPoints[startRotID].transform.rotation;
transform.rotation = Quaternion.RotateTowards(transform.rotation, destRot, step)

但两者在一起永远不会奏效。 跟随者如何总是向前看到下一个远点并在Z轴上进行旋转来自航点?

0 个答案:

没有答案