MGD
MGD

Reputation: 783

Collision detection for race course in iphone

i am wondering how could I detect collision on the course given in the attached image for example:

race course

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.

Upvotes: 0

Views: 186

Answers (2)

genpfault
genpfault

Reputation: 52085

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 :)

Upvotes: 0

Noah
Noah

Reputation: 1966

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.

Upvotes: 3

Related Questions