I am trying to move a cube to three.js based on its rotation, but not sure how to do it.
Currently, I can rotate the rotation of the cube z with the keys A and D. And with the key W, I would like it to move forward relative to its rotation.
From 2D, I would do something like strings:
float angle = GradToRad(obj.rotation);
obj.x = obj.x + cos(angle) * velocity;
obj.y = obj.y + sin(angle) * velocity;
Here is an image of the current implementation.

How can I apply something similar in three.js?
source
share