Collision problems

Started by
0 comments, last by oliii 15 years, 7 months ago
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.
Advertisement
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.

Everything is better with Metal.

This topic is closed to new replies.

Advertisement