[Author Prev][Author Next][Thread Prev][Thread Next][Author Index][Thread Index]

Re: [pygame] Bitmask Collision Response



Hi,

If your object has collision points (i.e., feet, wheels, etc.), the collision can be considered to be a point-point collision. 

For example, consider a 2D car game viewed from the side.  Suppose the car is a certain height and falls vertically onto a variable terrain.  Then, when you have your collision, and you know that, say, the back wheel hits first, you can find the terrain's normal at the point of contact (you can sample around the contact point, or you might have a better way of doing it).  Then, because rubber is bouncy, the new direction of the wheel will be the reflection of the downward vector around the terrain normal (  = v - 2*dot(v,n)*n  ).

If this is completely on the wrong track, give more info. like Tyler suggests.

Ian