Rotate a Vector3 by another

I’m trying to have something similar to getDirection.
For example:

const position = Vector3.Zero(),
      rotation = new Vector3(0, Math.PI / 2, 0),
      toAdd = Vector3.Forward();

const rotated = toAdd.rotateByVector3(rotation);
//rotated is { 1, 0, 0 } or Vector3.Right()

rotateByVector3 does not exist, it is just an example.

How can I do something similar to the example?

I think you can set your rotation.toQuaternion() and then either use:

Or to rotate by angles:

3 Likes

Thanks so much!