Hi,
I'm using Python to get the local transformations from Houdini to a game engine, but I realized that the rotations are reversed. I can't change how the engine works, so I need to export the rotation values in the matrix already inverted.
I'm a complete failure when it comes to properly understanding Matrices, and couldn't figure out how to invert just the rotation vectors in a Matrix4 object obtained with objNode.localTransform(). I even tried numpy, but my own math incompetence wins. :-(
Is there a way to do that from Python in Houdini?
Thanks!
Invert rotations in a Matrix4
2084 1 1- Ethernaut
- Member
- 24 posts
- Joined: 10月 2014
- Offline
- Ethernaut
- Member
- 24 posts
- Joined: 10月 2014
- Offline
Never mind, figured it out… maybe not the best method, so here it goes (Tz, Rx and Ry are inverted in this case):
values = dict() values["translate"] = ( n.parm("tx").eval(), n.parm("ty").eval(), n.parm("tz").eval()*-1 ) values["rotate"] = ( n.parm("rx").eval()*-1, n.parm("ry").eval()*-1, n.parm("rz").eval() ) values["scale"] = ( n.parm("sx").eval(), n.parm("sy").eval(), n.parm("sz").eval() ) xform = hou.hmath.buildTransform( values )
Edited by Ethernaut - 2018年5月22日 00:49:30
-
- Quick Links