在Unity C#中围绕中心点旋转 [英] Rotate around center point in Unity C#
本文介绍了在Unity C#中围绕中心点旋转的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我想在 z 轴(倒置)上旋转我的相机,但白色 Capsule 始终需要位于相机的中心(见图).
I want to rotate my camera on the z axis (upside down) but the white Capsule always needs to be at the center of the camera (See picture).
提前致谢!
推荐答案
如果您不熟悉三角学,最简单的方法是使用 LookAt 方法.http://docs.unity3d.com/ScriptReference/Transform.LookAt.html
The simplest way to do this if you are not familiar with trigonometry is to use the LookAt method. http://docs.unity3d.com/ScriptReference/Transform.LookAt.html
将相机的位置设置到您想要的位置,然后使用 LookAt 旋转相机的变换.
Set the position of the camera to where you want it, and then use LookAt to rotate the camera's transform.
这篇关于在Unity C#中围绕中心点旋转的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文