Jump to content
  • Advertisement
Sign in to follow this  
Narf the Mouse

I'm trying to impliment physics using...

This topic is 3172 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts

...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.

Share this post


Link to post
Share on other sites
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?

Share this post


Link to post
Share on other sites
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.

Share this post


Link to post
Share on other sites
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?

Share this post


Link to post
Share on other sites
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.

Share this post


Link to post
Share on other sites
Sign in to follow this  

  • Advertisement
×

Important Information

By using GameDev.net, you agree to our community Guidelines, Terms of Use, and Privacy Policy.

Participate in the game development conversation and more when you create an account on GameDev.net!

Sign me up!