Dismiss Notice
Join Physics Forums Today!
The friendliest, high quality science and math community on the planet! Everyone who loves science is here!

Simple rigid body collision reaction

  1. Jan 10, 2012 #1
    Simple rigid body collision reaction (Newton III)

    Hi everyone! I'm writing a physics engine as part of a game i'm making. Up until this point i've implemented inter object collisions in a rather quick and dirty manner. Whenever something moves into something else, it is simply teleported back out to the edge. This implementation worked for a while, but amongst other problems, it causes anything not currently moving to be an immovable object, which is not good.

    I already have written support for forces and impulses (and friction), and i believe this is the more correct way to go. I had a long discussion with a friend who educated me a bit on the subject. I understand that newton's third law is integral here. that any two colliding objects have an equal(but opposite) impulse applied to them, and that this impulse is dependant on their relative masses and velocities

    he also talked a lot about the concept of a collision surface, which is something i didn't get quite as well. I understand it to be a point between the two objects, that is weighted according to their masses, and that travels in a straight ttrajectory

    At this point, i feel that i've got a handle on the basics. I'm not certain exactly what to do, but i feel i'd be able to understand it if i had a little more help . So i come to you wonderful people hoping for a little assistance in that regard.

    essentially, i need to figure out what impulse to apply to a colliding pair of objects.

    in addition, there's a problem that i don't fully understand. I've designed my engine using what i now now to be the A posteriori (Discrete) model, which means that it processes things in discrete frames, moving all objects, resolving collisions and altering velocities, before moving them again at the start of the next frame.

    An issue i see with this model is that when two objects collide, they are inside each other. And if i'm going to be using impulses to move them out again, there does seem to be the possibility of them not colliding with enough energy, so that the impulse isn't strong enough, so that the objects are STILL interpenetrating after being moved in the next frame. This would lead to the impulse being applied multiple times, which is not good. I'm wondering if it would be best to keep my current approach of teleporting things out as well, but adapt it to move the objects to relative positions based on the collision surface (essentially fastforwarding their motion through however many frames it would take to make them stop colliding). does that make sense or seem bad ?

    Any advice in these matters is appreciated.
    Last edited: Jan 10, 2012
  2. jcsd
  3. Jan 11, 2012 #2
    bump! can anyone help? maybe i should have tried the general physics forum :(
Share this great discussion with others via Reddit, Google+, Twitter, or Facebook