尽管有世界轴,如何向前移动游戏对象?(How to move game object forward despite of world axises?)

我正在写一个脚本,我通过按下按钮和鼠标来控制相机。 我需要相机始终向前移动(View Frustum被定向),但它仅在世界轴上移动。 怎么做?

I`m writing a script, where I control the camera by pushing buttons and by mouse. I need camera always moves forward(where View Frustum is directed ), but it moves only on world axises. How to do it?

最满意答案

你可以用

MyCamera.transform.Translate(Vector3.forward);

要向前移动相机,MyCamera当然是你的相机。

You could use

MyCamera.transform.Translate(Vector3.forward);

To move the camera forward, where MyCamera is of course your camera.

更多推荐