**Topic category:** Help with MCreator software

Ive been making a projectile that chases after the player,which uses the set movement vector block to move.

i have found a formula to calculate the direction from one 3d point to another, which goes like this:

angle = arccos ( a * b / |a| * |b| );

where:

a * b = ax * bx + ay * by + az * bz

|a| = sqrt( ax * ax + ay * ay + az * az )

|b| = sqrt( bx * bx + by * by + bz * bz )

and ive also found the way to change that angle into a 2d vector for x and y, which is explained in this document:

https://en.wikipedia.org/wiki/Unit_circle

but i dont know the method for turning that 2d formula into a 3d fomula that i can use.

does anyone know how to turn an angle into an X,Y,Z movement vector?

speed should be variable.

alright, a friend of mine whos good a trig gave me a much easier way to do this than i tried to cook up:

First, find both of the objects 3d positions in space. We'll call these position vectors A and B. Then subtract the vectors, B-A. , you do this by subtracting the individual dimension coordinates, like Bx-Ax, etc. We'll call the resultant vector R, and it is a vector that points directly from point A to point B.

Find the length of vector R. sqrt(Rx^2+Ry^2+Rz^2)

Divide each component of R (minus the ^2) by the total length given by that formula. That gives you a vector that point towards B but is only one unit long. Then multiply that unit vector by whatever your desired velocity is and use that as the velocity for the homing thing.

I'd be damned. That's actually a smart way of doing this.