如何在Ogre3D中将对象设置为另一个对象?

时间:2010-10-19 19:11:21

标签: c++ 3d rotation ogre3d quaternions

我试过这样做:

    Ogre::Vector3 src = bone1->_getDerivedOrientation() * Ogre::Vector3::UNIT_X;
 Ogre::Quaternion quatt = src.getRotationTo(bone2->_getDerivedOrientation() * Ogre::Vector3::UNIT_X);
 bone1->rotate(quatt);

 src  = bone1->_getDerivedOrientation() * Ogre::Vector3::UNIT_Y;
 quatt = src.getRotationTo(bone2->_getDerivedOrientation() * Ogre::Vector3::UNIT_Y);
 bone1->rotate(quatt);

 src = bone1->_getDerivedOrientation() * Ogre::Vector3::UNIT_Z;
 quatt = src.getRotationTo(bone2->_getDerivedOrientation() * Ogre::Vector3::UNIT_Z);
 bone1->rotate(quatt);

并且根本没有运气。是否有一个简单的方法来设置一个骨骼旋转给其他任何提示或想法将非常感激。感谢。

1 个答案:

答案 0 :(得分:1)

再一次,它永远不会失败。我发布此消息后,我会继续查看API文档并找到解决方案。对不起。

它很简单:

bone1->setOrientation(bone2->_getDerivedOrientation().w,bone2->_getDerivedOrientation().x,bone2->_getDerivedOrientation().y,bone2->_getDerivedOrientation().z);