开发者

How to implement restitution coefficient into a simple physics engine?

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 res开发者_运维问答titution. How is a restitution coefficient property implemented in physics engines?


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

How to implement restitution coefficient into a simple physics engine?

How to implement restitution coefficient into a simple physics engine?

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.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜