Unusual polygon collisions

Discuss any Chipmunk bugs here.

Unusual polygon collisions

Postby kezeali » Thu Oct 25, 2007 9:48 pm

I'm not sure if this is a bug or just stupidity on my part, but I can't get certain polygons to collide properly (with other polygons or segments). For example the marked edges of the following never collide:
Code: Select all
cpVect verts[] = {
      cpv(-15,-15),
      cpv(-15, 15),
      cpv( 15, 15),
      cpv( 15,-15),
// from here
      cpv( 9,-15),
      cpv( 5,-25),
      cpv( -5,-25),
      cpv( -9,-15),
// to here
   };


The problem seems similar to what would happen if the polygon winding was incorrect, but as far as I can tell it's fine.

Any ideas?
kezeali
 
Posts: 2
Joined: Thu Oct 25, 2007 9:32 pm

Re: Unusual polygon collisions

Postby slembcke » Fri Oct 26, 2007 1:24 am

From a quick sketch, it seems that is not convex. Is that correct? You can use concave collision shapes, but you need to decompose it into convex shapes and add them separately.

Also, if possible, give them a little bit of overlap so that you don't get "cracks" between the polys that a line segment could slip into.
Can't sleep... Chipmunks will eat me...
Check out our latest projects! -> http://howlingmoonsoftware.com/wordpress/
User avatar
slembcke
Site Admin
 
Posts: 4164
Joined: Tue Aug 14, 2007 7:13 pm

Re: Unusual polygon collisions

Postby kezeali » Fri Oct 26, 2007 3:25 pm

Yeah, it's a square with a bit sticking out - so it isn't convex. Thanks for clearing that up :D
kezeali
 
Posts: 2
Joined: Thu Oct 25, 2007 9:32 pm


Return to Bugs

Who is online

Users browsing this forum: No registered users and 2 guests