本文介绍了XNA 围绕它的 CreateLookAt“目标"旋转相机的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
如何围绕它的 CreateLookAt() "Target" Vector3 位置旋转相机作为枢轴点,因此相机将围绕该枢轴点旋转"并始终面向"该枢轴点.
How to rotate camera around it's CreateLookAt() "Target" Vector3 position as pivot point, so the camera will "rotate around" that pivot point and always "facing" to that pivot point.
请回答,谢谢
推荐答案
假设您已经有了旋转轴和角度:
assuming you have your rotation axis and angle already:
cameraPosition = Vector3.Transform(cameraPosition - cameraTarget, Matrix.CreateFromAxisAngle(axis, angle)) + cameraTarget;
view = CreateLookAt(cameraPosition, cameraTarget, cameraUp);
这会围绕目标旋转相机的位置并适当地重置视图矩阵.
This rotates the camera's position around the target and resets the view matrix appropriately.
这篇关于XNA 围绕它的 CreateLookAt“目标"旋转相机的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!