3D 世界到本地的转换
我在尝试设置节点的本地位置以匹配给定的世界位置时感到非常头疼。
我得到了一个解决方案,但是,AFAICS,它只考虑了方向和位置,但不缩放:有
node_new_local_position = node_parent.derivedOrientation().Inverse() * ( world_position_to_match - node_parent.derivedPosition() );
问题的节点是node_parent; node_parent 本地和派生属性(方向、位置和缩放)以及其完整矩阵变换是已知的。
所有位置都是3d向量;方向是四元数;完整变换是一个 4x4 矩阵。
有人可以帮我修改解决方案以支持节点层次结构中的扩展吗?
预先非常感谢,
比尔
I am having a real headache trying to set a node's local position to match a given world position.
I was given a solution but, AFAICS, it only takes into account orientation and position but NOT scaling :
node_new_local_position = node_parent.derivedOrientation().Inverse() * ( world_position_to_match - node_parent.derivedPosition() );
The node in question is a child of node_parent; node_parent local and derived properties (orientation, position and scaling) are known, as well as its full matrix transform.
All the positions are 3d vectors; the orientation is a quaternion; the full transform is a 4x4 matrix.
Could someone please help me to modify the solution to support scaling in the node hierarchy?
Many thanks in advance,
Bill
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
我不是 ogre3d 方面的专家,但我想您需要类似的东西:
其中
_getFullTransform ().inverse()
是node_parents 的完整
4 x 4
逆变换。编辑:看起来也许您应该使用
_setDerivedPosition
来完成您想要完成的任务。I'm no expert in ogre3d but I guess you would need something like:
where
_getFullTransform ().inverse()
is a full4 x 4
inverse ofnode_parents
transform.EDIT: It looks like maybe you should just use
_setDerivedPosition
which does exactly what you're trying to accomplish.