在 OGRE 中获取对象的方向
我有一个小人包含身体和脑袋,脑袋和身体通过骨头连接,并且我已经知道了骨头的名称,现在我想获取脑袋的方向,可能吗?
我写了下面这样的代码,但是无法用:
Entity *smith = m_sceneManager->getEntity("Smith"); Bone *head = smith->getSkeleton()->getBone("Bip01 Head"); Vector3 direction = head->_getDerivedOrientation() * Vector3::UNIT_X; std::cout << StringConverter::toString(direction) << std::endl;
I thought I should multiply by other than the unit x vector, so I tried all the combinations. In this case (i.e. Smith entity), I got the correct answer using -Vector3::UNIT_X
, so I thought this is the correct solution. I tried with other entities, but I failed to get the correct answer.
Any idea?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
Multiplying a quaternion by negative Z should correctly return the direction as a vector:
详情请看 this post on the Ogre forums.