问题
With a rotated object in my scene, how can I translate a global vector into the local space of that rotated object, so that they are rendered in the same spot of the global vector?
Take for example a cube that is rotated but at the global origin. Now I would like to render lines for each global dimension (x, y, z), but added as children to the rotated cube, not the global scene. How do I calculate and in three.js implement the rotation of those vectors so they will line up?
回答1:
You want to add an object as a child of a parent object such that the world position and orientation of the child do not change.
You can do that using the following pattern:
parent.attach( object );
three.js r.107
来源:https://stackoverflow.com/questions/26400570/translate-a-vector-from-global-space-to-local-vector-in-three-js