Jump to content
  • Advertisement
Sign in to follow this  
ProblemBaby

Collision Detection for a sphere

This topic is 3500 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

Hello I'am playing around a little with a sphere in a 3d world my code is heavly based on this ( http://www.gamedev.net/reference/articles/article1026.asp ) document. The only thing that makes me troubled is when I collide with 2 polygons at the same time. for example the case when iam falling down into a V-shaped hole, I end up sliding around forever in the bottom. So what iam wondering is if someone have a nice solution for collision between more than 1 polygon at a time. thanks in advance

Share this post


Link to post
Share on other sites
Advertisement
This is a common problem.
Usually after each collision the delta movement (or speed) decreases.
In this case you can check if speed is below a certain threshold, when this is the case, just set speed to zero. In most cases this already should solve your problem.
A second check might involve; if in one 'frame' collision with the same polygon occourse more then a certain time (for example more then two), set speed to zero. Just keep the delta movement per 'frame' or iteration low enough and it should be a problem.

For simple cases, this should work. For more complicated I wouldn't recommend writing the collision detection/responce yourself.

Share this post


Link to post
Share on other sites
If by "nice solution" do you mean one that "appears" to work well, or the actual physical solution?

I did something similar in 2D. If an object had a movement vector, I found the closest object that it would collide with (if it happened to collide with any), unless there were more than one at nearly equal distances. If I determined that there was less than a .001m difference between the collisions, I would use both (or all). From there, I just applied actual physics... Depending on your system, you may not be able to use -9.81m/s^2 for gravity, but so long as everything is scaled appropriately, the physical solution is easy enough.

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.

We are the game development community.

Whether you are an indie, hobbyist, AAA developer, or just trying to learn, GameDev.net is the place for you to learn, share, and connect with the games industry. Learn more About Us or sign up!

Sign me up!