How can i find an angle between 2 3D points? I am doing a 3D game
One way is with a direction vector.
Subtract one object’s position from the other and normalize that.
DirX=Ax-bx DirY=ay-by Dirz=az-bz Length=sqrt(dirx^2+diry^2+dirz^2) Dirx=dirx/length DirY=diry/length Dirz=dirz/length
I’d recommend reading some tutorials about vector math. It’s useful for 3d stuff even if you just learn the basics.
There are other ways to define angles in 3d: spherical coordinates, axis angle, 3x3 matrices, quaternions. They all have their uses.
Develop games in your browser. Powerful, performant & highly capable.
Thanks so much man! I forgot there are so much ways to make this thing, i just did some random vector calculations without thinking much and then wondered why nothing worked