Jump to content
  • Advertisement
Sign in to follow this  

Clanlib Collision (get_collision_point) problem

This topic is 4862 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, This will probably be a very simple answer for some of you more clanlib minded folks (since I cannot sem to find a board anywhere related to the library. The problem im having is simple, for the collision engine (to allow object to be set at the proper point, ie, to land on the ground properly in a physics simulation, i need to know the point of contact. For that there is get_collision_points(), the problem is, apparently it doesent work (at least not for me). The collision works, and goes into the function, but neight object reports any points in the vector returned from get_collision_points(). Here is a quick mockup test I just compiled , so I can point out everything. keep in mind, im not using iterators on the vector for clarity to coders unfamiliar with STL, but familiar enough to help me with clanlib :). Also, I understand this is unoptimized as far as not saving/loading the structures, im doing this for clarity to show you EVERYTHING.
// Create the collision outline for the sprite
CL_CollisionOutline sprite(&test->get_frame_surface(0).get_pixeldata());
CL_CollisionOutline sprite2(&test->get_frame_surface(1).get_pixeldata());

std::vector<CL_Pointf> points = sprite.get_collision_points();

     // This is fired off
     MessageBox(NULL, "Collision Made", "test", MB_OK);	
     for(int n=0; n<points.size(); n++)
          // This is not
          MessageBox(NULL, "Collision POint Found", "test", MB_OK);

Notice, because the collision passes, i believe I can safely presume the structures were working approprietly. The frame size of the sprite is 48x48, and 20x2 pixels inword undoubteldy collides with the sprite. Thanks in advance for your help guys Richard P. Cesar [Edited by - PaulCesar on November 24, 2005 2:47:27 PM]

Share this post

Link to post
Share on other sites
Guest Anonymous Poster
Also, I don't believe collision info is stored by default. You need to

sprite.enable_collision_info(true, true);

before you call sprite.collide.

Share this post

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

  • Advertisement

Important Information

By using GameDev.net, you agree to our community Guidelines, Terms of Use, and Privacy Policy.

GameDev.net is your game development community. Create an account for your GameDev Portfolio and participate in the largest developer community in the games industry.

Sign me up!