• Advertisement
Sign in to follow this  

2d Car Track Collision Response

This topic is 1243 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts

Hello,

 

So, I am working on a 2d car game.  For drivable surfaces, I was planning on using a bit map mask so I could determine if the road surface was drivable or not.  However, anyone have any ideas on how to handle collisions, instead of saying cannot drive, I want to handle a collision, but I would normally need a normal of the face and then use that to bounce off of that surface.  With a bit map, I just know they can't drive, how would I go about creating a normal from a bitmap?

 

Any thoughts?

Thanks

Share this post


Link to post
Share on other sites
Advertisement


how would I go about creating a normal from a bitmap?

 

You could try computing a least squares line using the local 'edge' points of your bitmap.  By edge points, I mean those points in the mask flagged as collidable, yet adjacent to non-collidable points.  As long as your bitmap maintains fairly smooth 'edges', I would think this would yield reasonable normals to use in collision response (those normals would, of course, be perpendicular to the least squares line that was computed).

Share this post


Link to post
Share on other sites
Sign in to follow this  

  • Advertisement