Collision on Multiple Shape Body

Official forum for the Chipmunk2D Physics Library.
Post Reply
vorp
Posts: 2
Joined: Mon Jan 19, 2009 8:57 pm
Contact:

Collision on Multiple Shape Body

Post by vorp »

Hello.
I've just started with Chipmunk and am trying to do something very basic for, essentially, a science experiment, of all things.
I basically need to push a bunch of airplane like shapes together and see how they naturally 'fit' together.
So I've created three poly shapes (since the overall airplane form is non-convex).
One for the fuselage and two mirrored shapes for the the wings. All are convex.
I've copied much of the code in the Moonbuggy example to get started.
I've added the three shapes to a single 'plane' cpBody.
I've done this in a function so I can create a bunch of planes.

The results:
The parts stick together correctly but collisions between airplanes are not working as hoped.
What I seem to be getting is wing shapes correctly colliding with the fuselages but wings not correctly colliding with other wings (of other airplanes, of course).

The results seem a bit sporadic so I'm wondering if it may be related to some timestep controls or other tuning.
I've played with my timestep as well as cpSpaceResizeStaticHash and cpSpaceResizeActiveHash to no avail.
It really looks like there is no collision detection going on with some wings.
I'm not using any callbacks. I'm simply trying to get something approximating basic collisions.

I've also tried changing the group parameter for each plane but, assuming I'm doing it correctly, that doesn't help.
I looked for an example or demo that includes a composite shape but can't find any.

If anyone has any ideas to help I'd love to hear them. Thanks very much!
maximile
Posts: 157
Joined: Mon Aug 20, 2007 12:53 pm
Location: London, UK
Contact:

Re: Collision on Multiple Shape Body

Post by maximile »

Problems like this are often caused by incorrect polygon winding. Have you checked this? If you mirrored the wing from one side to the other, that might mean one wing is incorrectly wound.
vorp
Posts: 2
Joined: Mon Jan 19, 2009 8:57 pm
Contact:

Re: Collision on Multiple Shape Body

Post by vorp »

Hey! Thanks! That was the problem after all. I had quickly mirrored the verts from one wing to another.
I wasn't keeping close enough watch on that issue when I was building my geometry.
Next time I'll be more careful!
You're a king!
Post Reply

Who is online

Users browsing this forum: No registered users and 36 guests