# Collision problems

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

## Recommended Posts

Hello im new here. Im not a game programmer or generally not a programmer at all. I only know a few in C++ and JAVA, mainly i use scripts. Im making a physic system for warcraft 3. Ive got the collision impulse and friction working. But i have a problem which is how to move the bodies (they are spheres) apart when they are inside eachother. Atm im doing this by pushing them away by finding the distance D^2 = (PosB-PosA)^2-(rA+rB)^2. Where PosA/B are the positions of object A and B. and rA/B are the radiuses. And then i do a square root on the d multiplied with 0.1. Why 0.1 is because if i move them with the full penerations length, the objects starts to jitter or like shaking away from eachother. I dont know what causes this, and this is the first thing i need help in. Atm i have collision detection at the very end of each timestep. The 2nd problem i have is when i try to stack the spheres right on top of eachother, because of gravity they sink into eachother when there are many objects on the stack. Also the objects on top will also push the object below causing it to bounce again when it isnt supposed to. I need help mostly with the first problem. Because i think if i can correctly move them apart without the shaking/jitter then tat will be enough to prevent them sinking into eachother.

##### Share on other sites
the 'stacking' problem is a hard one.

You have to consider constraints, that not just affect the positions, but also the velocities and forces. It is not an easy problem unfortunately.

1. 1
2. 2
Rutin
19
3. 3
4. 4
5. 5
frob
13

• 9
• 15
• 10
• 9
• 17
• ### Forum Statistics

• Total Topics
632602
• Total Posts
3007364

×