Li, A asked about the direction vector in a previous discussion. I am still confused with what the .position property returns. It s obviously a Number3D.
This describes the absolute position in the coordinate system as well as the vector starting at [0,0,0] and ending at the Number3D. But what I actually need is the vector of the Object3D. The direction! Once I have the direction of both objects I simply say: angle = arcos(v1 * v2) This is why I asked about the direction vector of an Object3D. Please let me know if I am wrong? On Feb 7, 8:04 am, Patrick <[email protected]> wrote: > Li, > > Thanks a lot. I am currently reading 3D Math Primer and I am trying to > link the stuff in the book (c++) to AS3. > What I want to do is a simple radial radar the shows enemie-positions > around the player object. > > Thanks for your help, Patrick > > On Feb 7, 7:26 am, Li <[email protected]> wrote: > > > I'm not sure if there is a native method, but something like this should > > work (based on the dot product of 2 vectors): > > > var obj1Vector:Number3D = obj1.position; > > var obj2Vector:Number3D = obj2.position; > > var cosAngle:Number = > > obj1Vector.dot(obj2Vector)/(obj1Vector.modulo*obj1Vector.modulo); > > var angle:Number = Math.acos(cosAngle); > > > This will be the angle between the positional vectors of the objects in the > > plane they define. > > I'm not sure what you mean by Y-angle, but just post more details if this > > doesn't help you. > > > On Sat, Feb 7, 2009 at 4:44 AM, Patrick <[email protected]> wrote: > > > > Hi All, > > > > Is there a method to retrieve the Y-angle between two objects, while > > > both objects are moving? > > > > Thanks
