Page 1 of 1

[solved] easy question - cpSegmentShapeNew()'s dont collide

Posted: Tue Jan 01, 2013 8:34 pm
by donkey
Hi all, this is my first use of chipmunk so I apologise if this is so basic. I hope it is, because it means a quick and easy answer!

Ok so I see in the demo app that comes with chipmunk (i am using v6.1.2) and I am building for OSX using xcode, that some of the demo scenes use cpSegmentShapeNew(). For example I draw your attention to "springies.c". The add_bar() function actually uses cpSegmentShapeNew().

Now all I am trying to achieve, is to make these 'bars' collide... I can't...

I've tried layers, groups, collision_type and can't get the shapes to collide. All debugs seem to suggest that these variables for the shapes are all set to default. In fact I can't even get them to collide with the static walls.

Now the minute I change cpSegmentShapeNew() and say use cpBoxShapeNew(), bang it works. The shapes collide with each other and the static wall. These box shapes actually collide with the segment shapes too! (thats doing my head in a bit).

Any thoughts for a first timer here?

Re: n00b easy question - cpSegmentShapeNew()'s dont collide

Posted: Wed Jan 02, 2013 10:10 am
by slembcke

Re: n00b easy question - cpSegmentShapeNew()'s dont collide

Posted: Wed Jan 02, 2013 10:11 am
by slembcke
Oh. Hrm. The docs should really also mention that you only need to call that function once when your program starts to enable segment-segment collisions.

Re: n00b easy question - cpSegmentShapeNew()'s dont collide

Posted: Wed Jan 02, 2013 8:17 pm
by donkey
brilliant! thank you soooo much!