Question

I am writing a simple 2d physics engine that supports circle-circle collision and i can't figure out how to retrofit my collision resolution method to add restitution. How is a restitution coefficient property implemented in physics engines?

Was it helpful?

Solution

I don't know much about implementing game physics but I would use the following formulas found on the wikipedia page:

alt text

alt text

These formulas tell you the velocy of an object after a collision given your constant Cr. This will be easy to place in your application if:

  1. You are using vectors to represent everything and you understand (and can perform) vector math (first year University knowledge at the least). Since you are making a physics engine I think you probably do.
  2. You have given mass to all of the objects in your physics world.

If you have done that then you can use those formulas to decay velocity upon collisions. Your collision calculations are separate to that; this deals with the momentum of your objects.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top