Quaternion Cameras and projectile vectors

烈酒焚心 提交于 2019-12-10 19:39:43

问题


In our software we have a camera based on mouse movement, and a quarternion at its heart.

We want to fire projectiles from this position, which we can do, however we want to use the camera to aim. The projectile takes a vector which it will add to its position each game frame.

How do we acquire such a vector from a given camera/quaternion?


回答1:


The quaternion doesn't represent a direction, it represents a rotation. You can define a vector that points in the direction that your camera is pointing initially (e.g. (0,0,1)) and transform it using the rotation represented by the quaternion.



来源:https://stackoverflow.com/questions/2646121/quaternion-cameras-and-projectile-vectors

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!