I'm trying to impliment physics using...

Started by
3 comments, last by Numsgil 14 years, 6 months ago
...This webpage: Collision.html My problem is the collision normal 'N', with regards to an OBB. What I understand: When dealing with a sphere or a particle, the collision normal is the direction from the point of collision to the center/location of the sphere or particle. That's fine; I can calculate that. The collision normal of a box is the face normal of the face collided with. Therefore - How do I get the face collided with? I could get the closest face, but then, the closest face is not necessarily the one collided with. ...Or, hmm...If I relocate to its last position, then do...Er, bisection?...Testing till it's 'resting', then the closest face is likely enough to be the one collided with. Now, all I need is alternate intersection methods that return the distance of intersection along with wether there is intersection. Thoughts? Thanks for any and all help.
Advertisement
Physics isn't my forte but maybe could the velocity vector of the object relative to the cube give you a hint as to which face of the cube was hit?
There are a couple of ways to handle this.

The easiest to understand is the separating axis theorem. See this link for a good introduction.

The SAT relies on the bodies not really rotating, though. If your bodies rotate a great deal between one frame and the next, or you want to find the exact[ time of collision, you have to delve into some iterative schemes like "conservative advancement", which is described (not necessarily called that, though) in Mirtich's PhD thesis, chapter 2 ("Collision detection"). This is usually where the PhD lives, but the link seems to be down right now.
[size=2]Darwinbots - [size=2]Artificial life simulation
I'd prefer to be able to handle fast rotations; it's for a graphics/physics library I'm writing (Re: Here)

Thanks, I'll check on that link again later.

I've got the calculations down for a spherical collision, but it turns out I forgot something - Getting the point(s) of collision. What are the options there?
If the two shapes are spheres, you can find the exact time of collision by solving the equation (p2(t) - p1(t))^2 = (r1+r2)^2, where p is your position over time and r is the radius. Then plug in that time value to find the position of either sphere, and then you do n = p2(t) - p1(t) and normalize n and that's your collision normal.
[size=2]Darwinbots - [size=2]Artificial life simulation

This topic is closed to new replies.

Advertisement