# Collision Detection for a sphere

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

## 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 on other sites
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 on other sites

I will fiddle around a little with your idea in mind.

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

1. 1
Rutin
45
2. 2
3. 3
4. 4
5. 5
JoeJ
19

• 13
• 10
• 12
• 10
• 13
• ### Forum Statistics

• Total Topics
632998
• Total Posts
3009811
• ### Who's Online (See full list)

There are no registered users currently online

×