Collision detection for race course in iphone
i am wondering how could I detect collision on the course given in the attached i开发者_开发技巧mage for example:
In XNA that could be done easily but i dunno how to make it possible in OpenGLES for such scenario as simple collision with rectangles is not a big deal but for this case I need help.
Opengl doesn't support any native collision detection, its just a polygon rendering utility. If you wanted to preform collision detection on the given image, you could set up an edge finder, and then load the detected edges into your own custom collision detection algorithm - but that has nothing to do with opengl or opengles.
For collision detection a simple and very dirty solution is to map your player position to the bitmap's coordinate system and check the pixel color/value. Grey is on-course, white is off.
Collision response is a whole other question :)
精彩评论