ClanLib Collision Detection

Started by
2 comments, last by sphair 14 years, 1 month ago
I have been playing with ClanLib-2.1 for about a week now. Drawing sprites, using resources, etc is all fairly intuitive. The part that is not intuitive is collision detection. Here is what I am trying to do. All I would like to do is make a sprite bounce off of the four edges of a window. This is easy when I compare the x and y coordinate of the sprite against 0 and width / height of the screen. Everything works perfectly in this case. The case that does not seem to work is when I attempt to use the CL_CollisionOutline class. I have two png files that I use for the "walls" of the screen. One png is a horizontal bar, the other is a vertical bar (pretty simple). Iterating through the CL_Contour and CL_Pointf vectors seems to have the correct collision points, but calls to CL_CollisionOutline.collides() just never seems to work. Note that drawing the outline of the CL_CollisionOutline vs the png image on the screen produces what I would think is correct for the collision point sampling. The code at this point is fairly large, as ClanLib requires quite a bit of glue code to get something running. But, if needed, I could make my example available for download, if that would help someone help me. I've been using the SpritesRTS example that comes with the ClanLib-2.1 install as a tutorial for collision detection. Can anyone offer some insight into ClanLib's collision detection, or at least point me to some docs or tutorials that might help? Thanks! mw
Advertisement
There is maybe a better chance to get a response if you post this on the official ClanLib forums?

http://www.rtsoft.com/forums/forumdisplay.php?f=13/clanlib
Will do! Thanks!
This was posted and solved at http://www.rtsoft.com/forums/showthread.php?t=3188

This topic is closed to new replies.

Advertisement