Rotation madness

   1292   1   0
User Avatar
Member
96 posts
Joined: Nov. 2017
Offline
I can't bend my head around this. I could isolate my problem to the rotation order of the Transform SOP and the Bone rotations.

I need to match bone rotations to primitive direction (2-point primitives). I get it to work nicely with using dihedral() for calculating my rotation angles. Unfortunately dihedral() doesn't take into account an up vector.

Let's see… Isn't there LookAt? Quick change in the vex code and my test geo which get's rotated by a Transform SOP points into the wanted direction with the correct up direction. Perfect. Unfortunately the same rotation values in the Bones rotation don't work so well. Bone points somewhere else. Remember? It worked correctly with the dihedral() values. LookAt delivers angles which can be misunderstood.

If I changed the Transform SOP's rotation order I can get the Bone and test geo back to align again, though now both point in the wrong direction. How can I change the LookAt() values that they are bulletproof or can I translate the values with a function like RxRyRz to RyRxRz? Or what are my options?

Dihedral() = correct rotation, no up vector
LookAt() = Theoretically correct, with up vector

Cheers
Tom
Edited by Tom Mangold - Sept. 25, 2019 10:03:11

Attachments:
rotationsTest16.hiplc (156.8 KB)

User Avatar
Member
96 posts
Joined: Nov. 2017
Offline
Managed to rotate the bones correctly. Switched to creating a matrix from lookAt() instead of rotation values directly (vector) and use cracktransform() to extract the rotation. This enables me to change the rotation order while extracting.

v@euler = cracktransform(0, 5, 1, {0, 0, 0}, m);

So far 5 works, but need to check if this is stable.
  • Quick Links