父子矩阵链接/顺序层次结构
我正在尝试在 XNA C# 中创建骨骼结构。
我试图通过矩阵的亲子关系来实现这一点。当我旋转父级时,子级应该以相同的方式旋转...
目前这工作正常,但是当在骨骼上执行 IK 例程时,一切都会变得疯狂。
有人可以检查我的代码吗?向量中的 ID 0 是父项,1 是子项,距父项偏移 52 个单位...
_boneList[0]._position = new Vector3(0, 0, 0);
_boneList[0]._localTransform = _boneList[0]._rotationTransform * Matrix.CreateTranslation(_boneList[0]._position);
_boneList[0]._globalTransform = _boneList[0]._localTransform;
_boneList[1]._position = new Vector3(0, 52, 0);
_boneList[1]._localTransform = _boneList[1]._rotationTransform * Matrix.CreateTranslation(_boneList[1]._position);
_boneList[1]._globalTransform = _boneList[1]._localTransform * _boneList[0]._globalTransform;
谢谢您的帮助。
I'm trying to create a Bone structure in XNA C#.
I am trying to achieve this by a parent-child relationship with matrices. When I rotate the parent, the child should rotate in the same manner...
At the moment this works fine, but when performing an IK routine upon the bones, everything goes wild.
Can someone check my code? ID 0 in the vector is the parent, and 1 being the child offset 52 units from the parent...
_boneList[0]._position = new Vector3(0, 0, 0);
_boneList[0]._localTransform = _boneList[0]._rotationTransform * Matrix.CreateTranslation(_boneList[0]._position);
_boneList[0]._globalTransform = _boneList[0]._localTransform;
_boneList[1]._position = new Vector3(0, 52, 0);
_boneList[1]._localTransform = _boneList[1]._rotationTransform * Matrix.CreateTranslation(_boneList[1]._position);
_boneList[1]._globalTransform = _boneList[1]._localTransform * _boneList[0]._globalTransform;
Thank you for the help.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
更多
发布评论
评论(1)
对我来说看起来不错,你应该还有其他问题,也许是角度问题?
这是我在 2D 中实现的代码,您可以在此处观看它的实际操作
It looks fine to me, you should have other problem, maybe with angles?
This is my code to reach it in 2D, you can watch it in action here