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

发布于 2024-09-28 08:20:32 字数 683 浏览 0 评论 0原文

我尝试这样做:

    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);

但一点运气都没有。有没有一种简单的方法可以将一个骨骼旋转设置为另一个骨骼旋转任何提示或想法将不胜感激。谢谢。

I tried do do this:

    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);

and had no luck at all. Is there a simple way to just set one bones rotation to anothers any tips or ideas would be greatly appreciated. Thanks.

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

荒人说梦 2024-10-05 08:20:32

一次又一次,它永远不会失败。当我发布这篇文章后,我会继续查看 API 文档并找到解决方案。 -。- 对不起。

很简单:

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

Once, again, it never fails. As soon as I post this I continue looking through API Docs and find the solution. -.- Sorry.

it was as simple as:

bone1->setOrientation(bone2->_getDerivedOrientation().w,bone2->_getDerivedOrientation().x,bone2->_getDerivedOrientation().y,bone2->_getDerivedOrientation().z);
~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文