Sign in to follow this  
madlios

Collision problems

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 this post


Link to post
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.

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

Sign in to follow this