You can transform a local position vector to world space using myObject.localToWorld(vector) and back to local with myObject.worldToLocal(vector)
Is there a similar convenient way to transform direction vectors between world and local space?
in Unity this would be myObject.TransformDirection and myObject.InverseTransformDirection
You can transform a Vector3
, representing a direction vector, from an object's local space to world space like so:
vector.transformDirection( object.matrixWorld );
Friendly tip: direction vectors in three.js are assumed to be normalized; that is, have length equal to 1. It is a good idea to adhere to that convention.
three.js r.82
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With