How to convert orientation to rotation.

   3013   5   1
User Avatar
Member
90 posts
Joined: March 2013
Offline
I'm wanting to convert the orientation attribute to a rotation attribute. The purpose is so that I can check the attributes coming from unreal and compare. Any idea how to do this?
User Avatar
Member
90 posts
Joined: March 2013
Offline
So, I did a point wrangle:
vector vec = set(0,0,1);
v@rot=qrotate(@orient, vec);

This does convert things to a vector 3. Not sure my unreal data looks like it's matching up exactly, but that's what I needed to see.
User Avatar
Member
8513 posts
Joined: July 2007
Online
what your rot represents is z axis direction of your quaternion, maybe that's what you were after
but in case you wanted euler rotations you can do this:

v@euler = degrees(quaterniontoeuler(p@orient, 0));
Tomas Slancik
FX Supervisor
Method Studios, NY
User Avatar
Member
90 posts
Joined: March 2013
Offline
Just in case anyone runs into a similar issue. Posting the solution I used. Went back to the original unpack and used the cracktransform to directly get the rotation values from the primintrinsics. This worked much better.

matrix m = primintrinsic(0,"packedfulltransform", @ptnum);
@rot=cracktransform(0,0,1,{0,0,0},m);
Edited by tadian - Aug. 29, 2022 10:55:59
User Avatar
Member
90 posts
Joined: March 2013
Offline
Thanks tamte, I will also take a look at that as well. Appreciate it.
User Avatar
Member
90 posts
Joined: March 2013
Offline
Brilliant, tamate. Just tried that and it gave me the correct results. Much simpler and can grab it on the fly. Very nice. Thank you.
Edited by tadian - Aug. 29, 2022 11:03:08
  • Quick Links