Traveling by Vector (3d Trigonometry)

In 3js we can rotate rendering objects via render.rotation.x/y/z.

And that’s in radians.

I can have a specific rotation in x and y, and then i need to move in that direction in 3d.

How do I calculate, what to move in each dimension x,y and z, when im moving in a specific vector angle?

After rotation, you can try translateX/Y/Z functions that work in the object space

Also there is .translateOnAxis

1 Like

I don’t get it.

How much should i move by x, y and z?

And if i use that function like, i don’t know how that connects with my problem.

here is an example of applying rotation to the object and then moving along one of the rotated axes, you can press buttons (more than once, if you like) and see how rotation/translation works in this case:

that’s entirely up to you, you want to move along a vector, the vector gives you a direction, it doesn’t tell you by how much you move along it.

If your rotational vector is something like velocity, you can calculate its length and move by that amount.

1 Like