Hey Ben, That stuff you are doing is really cool. I particularly enjoy seeing chaotic and organic stuff like that... Please do post any progress you do on this!
The help I could give you is recommend you a way of working, which, even though Im not sure its the best way, it worked for me when I worked with this kind of trigonometry stuff. Well, more than trigonometry, its vectors. To find the normal of a plane you can identify a face in it and then use its 3 vertices to extract 2 vectors that go from one vertex to each of the 2 others. With this, you can use the dot product to calculate the normal. Once you've got the normals of each plane you can easily calculate how much the object would need to turn in order to face another, and then apply differential increases to make it "turn" towards the other. Beyond this application, you can really control this kind of stuff with this method. Another thing that usually comes up in this sort of things is the age old problem of "the intersection of a line and a plane", or a vector and a plane. Dont know if it could help you in this particular situation, but its always handy to understand it and it is usually very helpfull. You can google the maths problem and there should be plenty of explanations around. If you control these 2 things, Im sure you will be able to achieve what you need. cheers, Li On Thu, Jan 8, 2009 at 6:04 PM, Makc <[email protected]> wrote: > > On Thu, Jan 8, 2009 at 12:41 PM, ben <[email protected]> wrote: > > 1 - Angle between two Object3D : > > in order to get it I'm doin this : > > > > leaf.position.normalize(1);//as dot product only works with normalized > > vector (as I now)... > > leafArr[j+1].position.normalize(1);//idem > > var angle:Number = leaf.position.dot(leafArr[j+1].position);//dot > > product > > > > I should return the cos of the angle and then use it to make my object > > rotate well, but this doesn't work : > > they are 3 dimensions of rotations and only one angle... > > this angle is rotation around vector1-cross-vector2 >
