this is how i would do it: first decide "what angle" i want to get, because there is more than 1angle between two points in a 3-dimensional system i assume you want the gradient-angle, so you have to eliminate the 3rd koordinate: x/y/z; x1/y1/z1 -> _distX = ( Math.sqrt( x1² + z1² ) - ( Math.sqrt( x² + z² ) ) _distY = y1 - y
now can continue with: angle = Math.atan ( _distY / _distX ) maybe this helps you a little bit, not sure if that is excactly what you wanted cheers olsn On 24 Mrz., 14:18, Manic <mar...@graphicfilth.com> wrote: > Hi, > > I'm trying to find the angle between two Number3Ds, everything I've > tried so far hasn't worked, I've had a go with using the screen > position, the scene position, the relative positions... everything. > > I want to make the large end of the arrows sit around the outside of > the striped box, forming a sort of halo around it. > > http://graphicfilth.com/uncommon/bin-release/uncommon.html > > Here's what I understand so far... > > The arrows are created as children of the main box, so vertex 0 is at > 0,0,0 while vertex 2 is assigned to the location of it's blue circle > using this code; > > theArrow.vertices[2].adjust(peep.scenePosition.x-scenePosition.x, > scenePosition.z-peep.scenePosition.z, peep.scenePosition.y- > scenePosition.y); > > Now, I don't know why this code works, in my mind it's wrong, but it > does work, so I guess I'm wrong. > > So, if I'm working using relative coordinates from the Arrow, I should > just be able to use the location of Vertex 2 and drop that into Trig, > something like; > > angle = Math.atan(theArrow.vertices[2].y/theArrow.vertices[2].x) > > then use that angle to plot the other 2 vertices around the center of > the main object. > > However it never returns accurate results, I've tried with every > possible combination of x/y/z over x/y/z from the coords, but nothing > seems to work. > > I'm tearing my hair out here, because I'm sure I've got the principle, > but not the execution. > > Thanks in advance > > Martin