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

Official forum for the Chipmunk2D Physics Library.
Post Reply
donkey
Posts: 2
Joined: Tue Jan 01, 2013 6:13 pm
Contact:

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

Post 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?
Last edited by donkey on Wed Jan 02, 2013 8:18 pm, edited 1 time in total.
User avatar
slembcke
Site Admin
Posts: 4166
Joined: Tue Aug 14, 2007 7:13 pm
Contact:

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

Post by slembcke »

Can't sleep... Chipmunks will eat me...
Check out our latest projects! -> http://howlingmoonsoftware.com/wordpress/
User avatar
slembcke
Site Admin
Posts: 4166
Joined: Tue Aug 14, 2007 7:13 pm
Contact:

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

Post 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.
Can't sleep... Chipmunks will eat me...
Check out our latest projects! -> http://howlingmoonsoftware.com/wordpress/
donkey
Posts: 2
Joined: Tue Jan 01, 2013 6:13 pm
Contact:

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

Post by donkey »

brilliant! thank you soooo much!
Post Reply

Who is online

Users browsing this forum: No registered users and 10 guests