- #1

- 39

- 0

## Main Question or Discussion Point

hi everyone. I'm working on a physics engine as part of a game i'm making, a hobby project. 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.

Since i already have support for forces, impulses, and friction, i've decided it's time to re-examine my collisions and make a better model for it.

I believe the formula i need for elastic collision is here: http://en.wikipedia.org/wiki/Momentum#Conservation_of_linear_momentum

the big pair of formulae, just under where it says "In one dimension" in bold letters. however, i need a little bit of help rearranging it. Those formulae give the final velocities of the object as an output. But i'd like to not go that far. The output I'd like is the Impulse to apply to both objects, in Ns (Newton-seconds). As i understand, both objects in a collision will recieve the same impulse. I want this so that i can do other (game related) things with it before applying it. If anyone could help with adjusting the formula to give me that, it'd be helpful.

The second issue i have though, is that the formula only covers perfectly elastic collisions. And there's a seperate formula for perfectly inelastic collisions. This seems inherently wrong to me, as nothing in nature is completely one or the other.

What i'd like to do is to figure out a way to incorporate the coefficient of restitution into things (the measure of elasticity between the objects). Considering the problem, i believe it will work similar to the coefficient of friction, in that either component having low elasticity will drive the coefficient towards zero. For example, a snowball thrown at a window will smush against it rather than bouncing off, even though one of the two is highly elastic, because the other is not. This is mostly just logical thought on my part.

I already have a simple formula for calculating the friction coefficient that i would probably reuse (sqrt(ab)). Assuming i keep within the bounds of a and b always being between 0 and 1, that would ensure my coefficient is always likewise.

Once i have a coefficient of restitution, how to incorporate it is the next step. I really don't know here, but logic tells me that something like multiplying the impulse by the coefficient, would work well.

what i ideally want to do is to be able to assign individual elasticity values to objects within my engine, work out a coefficient between them. Work out a collision impulse for the collision based on the object's masses and velocities, and figure out a way to combine the impulse and coefficient, before applying the impulse to the objects. I believe this should give me a more well rounded collision simulation, but i need some assistance to fill in the blanks.

I'm interested in any thoughts and assistance anyone can provide on these two subjects

Since i already have support for forces, impulses, and friction, i've decided it's time to re-examine my collisions and make a better model for it.

I believe the formula i need for elastic collision is here: http://en.wikipedia.org/wiki/Momentum#Conservation_of_linear_momentum

the big pair of formulae, just under where it says "In one dimension" in bold letters. however, i need a little bit of help rearranging it. Those formulae give the final velocities of the object as an output. But i'd like to not go that far. The output I'd like is the Impulse to apply to both objects, in Ns (Newton-seconds). As i understand, both objects in a collision will recieve the same impulse. I want this so that i can do other (game related) things with it before applying it. If anyone could help with adjusting the formula to give me that, it'd be helpful.

The second issue i have though, is that the formula only covers perfectly elastic collisions. And there's a seperate formula for perfectly inelastic collisions. This seems inherently wrong to me, as nothing in nature is completely one or the other.

What i'd like to do is to figure out a way to incorporate the coefficient of restitution into things (the measure of elasticity between the objects). Considering the problem, i believe it will work similar to the coefficient of friction, in that either component having low elasticity will drive the coefficient towards zero. For example, a snowball thrown at a window will smush against it rather than bouncing off, even though one of the two is highly elastic, because the other is not. This is mostly just logical thought on my part.

I already have a simple formula for calculating the friction coefficient that i would probably reuse (sqrt(ab)). Assuming i keep within the bounds of a and b always being between 0 and 1, that would ensure my coefficient is always likewise.

Once i have a coefficient of restitution, how to incorporate it is the next step. I really don't know here, but logic tells me that something like multiplying the impulse by the coefficient, would work well.

what i ideally want to do is to be able to assign individual elasticity values to objects within my engine, work out a coefficient between them. Work out a collision impulse for the collision based on the object's masses and velocities, and figure out a way to combine the impulse and coefficient, before applying the impulse to the objects. I believe this should give me a more well rounded collision simulation, but i need some assistance to fill in the blanks.

I'm interested in any thoughts and assistance anyone can provide on these two subjects