How to rotate one object as a parent of another object?

Dalmazzo's icon

My question is related to quaternions. I have values that control a [jit.anim.node], and I'm trying to find a way to adjust the initial position of that rotation, since the rotation is just an imaginary rotation that doesn't have an origin.
I would need to tell the object where the origin is, which will be always different, it dependes where the first values of the quaternion started to send its position. The idea is to first define its inverse-quaternion as the origin, and then rotates the parent object which that quaternion.
I have an idea of the inverse quaternion but in jitter I don't find how to reset the origin position of a parent object. I can imagine that if I have an invisible object that is the parent I can then rotate that parent to fix the child rotation in relation to the origin.

myo_quaternion.maxpat
Max Patch

Rob Ramirez's icon

i'm not entirely sure what you're asking, but I think you simply need to create an anim.node hierarchy and adjust the orientation of the child node to your desired initial values.

here's a patch demonstrating this. one of the cones is adjusted to point down initially, the other is not:

Max Patch
Copy patch and select New From Clipboard in Max.

Dalmazzo's icon

The point is that I'm controlling the rotation using quaternions not Euler angles.
To simplify, I don't understand how to rotate a parent node with an arbitrary quaternion, which affects the child node rotation controlled by another quaternion.
Parent node is the origin, child node is the object controlled by quaternions

Max Patch
Copy patch and select New From Clipboard in Max.

Rob Ramirez's icon

rotating by euler or quaternion makes no difference to jit.anim.node, all rotations are converted to quaternions.

the patch I posted above does exactly what you are describing, rotates a parent node with an arbitrary rotation (in this case, the anim.drive) affecting a child node with another rotation (in this case the rotatexyz attribute argument).

you shouldn't be modifying the parentquat attribute, as this is set by the parent anim.node. instead modify the quat attribute of the parent anim.node.