开发者

XNA Rotate Camera Around It's CreateLookAt "Target"

开发者 https://www.devze.com 2023-03-03 13:56 出处:网络
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.

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.

Please kindly answer, thank yo开发者_JS百科u


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.

0

精彩评论

暂无评论...
验证码 换一张
取 消