简体   繁体   中英

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:

比赛路线

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

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM