Darthfett / A-Priori-Physics-System

A side-scroller game based upon Mega Man X, with a priori collision detection, and objects being represented as a sequence of connected points.
3 stars 0 forks source link

Non mass-based collision resolution #24

Open Darthfett opened 12 years ago

Darthfett commented 12 years ago

Collision resolutions should be elastic (http://en.wikipedia.org/wiki/Momentum#Elastic_collisions). Currently (untested between two moving entities), mass is completely ignored, and objects' velocity are just reflected off the colliding line-segment.

Brain dump:

Dimensions can be split into components, and handled according to the elastic collision model on Wikipedia.

Reflection logic could be eliminated, as it would happen naturally through elastic collision.

Components of the elastic collision between a single point and a line-segment would be parallel and perpendicular to the vector normal to the line-segment, that is in the opposite direction of the relative velocity between the point and line segment.