Hey all, I’m stumped.
I’m trying to find the 2 (radian) angles between 3D points for example (0, 0, 0) --> (10, 10, 30)
I enlisted the help of a guy from work and came up with:
var dz:Number = lObj.myX-cView.camX;
var dy:Number = lObj.myY-cView.camY;
var dx:Number = lObj.myZ-cView.camZ;
B =Math.asin(dz/Math.sqrt(dx*dx+dy*dy+dz*dz));
A =Math.asin(dy/Math.sqrt(dx*dx+dy*dy));
(lObj is the object I’m moving towards. cView is the position of my viewer/camera.)
This seems to work, until my dx value goes into the negatives, then it just kinda goes crazy
Is there a more widely accepted way of finding the two angles?
I’d really appreciate it if someone could furnish me with an example, I’ve been trying to Google a solution for about two hours, although I’ve run across several promising leads most are over my head.