3D World to Local transformation
- by Bill Kotsias
Hello. 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