I have used coldet lib for my collision detection routines. It is working successfully. Contrary i have a problem on using physical reactions when two objects are collided. I don''t know how to calculate this reaction. For this i have purchased a book "physics for game developers" but in this book calculations are so deep that i can''t handle in a few days . I know i would use momentum to calculate the speed of objects after collision so this is ok. But i can''t calculate the new position of the object. Imagine that i have a random generated terrain (also has mountains), and a space ship. Space ship moves through the mountains. When this ship is collided with a mountain then i can calculate its new rotation by the help of the normal of the point where these two objects are collided. Problem is here : this approach doesn''t work so in the book, that i have mentioned, there was a calculation like
So i tried to use this code segment but that doesn''t produced the result that works for all conditions. If you could help then i would be happy (because i have been working days to solve this )...
Life is beautiful
Even if the ship is up side down, or in diffrent angels the cross product will always be the way to rotate around, so it doesnt mather how you collide..
You also need to "Inhertia" of momentum how much mass/force you got when you collide, this im not sure about but as i said it works good.
Now, hmm...
Vector Moment = Intersection + PlaneNormal * Dot(PlaneNormal, Center-Intersection);
*EDIT*: ARot *= Moment; // And maybe a constant value to fit your space.
Anyway thats the point where you have 90 degress between the plane normal and the center of gravity.
Using the lenght of this point to the center gives us a floot showing how far the forces will act from the center of gravity.
If you hit the mountain strate ahead, (So the Intersection + PlaneNormal) crosses the CG point it wont cause a rotation since the lenght of Center-Moment = 0
Still with me or did i lose you?
So what you just do is to move the ship until no intersection and rotate it using these values.
Oh, to make it look good you need the rotation acceleration, or it will just rotate slower and slower until the intersection is crossing the center.
What i did was to just use a constant value in the rotation functions
like Object.Rotate(ARot.x, ARot.y, ARot.z, 1);
And use the lenght or ARot to accelerate the rotation
If you juse make the ARot vector static and increase it
the way we calculated it before, it will not mather how you collide, not even how many intersections you got.
If you just land the ship on 2 boxes, one hitting the front and one the back part of the ship, the cross products will take eachother out, and you will not get a rotation, just like it should..
Oh well bare with me, let me know if you have any problem, and if anyone knows a easier "Better" way.
later.
fatal error C1004: unexpected end of file found
[edited by - Dies_Irae on August 6, 2002 11:58:16 AM]