custom shapes

Official forum for the Chipmunk2D Physics Library.
Post Reply
erwan.l
Posts: 2
Joined: Tue Aug 15, 2017 11:14 am
Contact:

custom shapes

Post by erwan.l »

Hi,

I am trying to create custom shapes.

To define my points, I used physics editor to create a list of points.

Result is here : Image.
Here below my 8 points :
((-1, 6), (5, 0), (58, 0), (63, 6), (63, 58), (58, 63), (5, 63), (0, 58))

Looks great except that I then lose collision detection as opposed to the below more "standard" shape :
((-32, -32), (-32, 32), (32, 32), (32, -32)).
How can i draw custom shapes while keeping collision detection?

Some extra details :
I am using an old chipmunk version (5.3.1) with these api's : cpbodynew,cpPolyShapeNew and cpSpaceAddStaticShape.
Bodies are rogue bodies (i.e not added to my space).

Regards,
Erwan
aisman
Posts: 145
Joined: Tue Mar 04, 2008 2:21 am
Contact:

Re: custom shapes

Post by aisman »

Try this one:
From the Documentation
Boxes:

....Adding a small radius will bevel the corners and can significantly reduce problems where the box gets stuck on seams in your geometry ...



cpShape *cpBoxShapeNew(cpBody *body, cpFloat width, cpFloat height, cpFloat radius)
Chipmunk4PB: The fastest way to write games together with PureBasic and the Chipmunk physics engine.
erwan.l
Posts: 2
Joined: Tue Aug 15, 2017 11:14 am
Contact:

Re: custom shapes

Post by erwan.l »

aisman wrote:Try this one:
From the Documentation
Boxes:

....Adding a small radius will bevel the corners and can significantly reduce problems where the box gets stuck on seams in your geometry ...

cpShape *cpBoxShapeNew(cpBody *body, cpFloat width, cpFloat height, cpFloat radius)
Thanks for this feedback.

My wrapper does not seem to have the radius argument.

function cpBoxShapeNew( body : PcpBody; width : cpFloat; height : cpFloat ) : PcpShape; cdecl;{$IFDEF USE_CHIPMUNK_LINK} external libChipmunk; {$ELSE} external; {$ENDIF}

I need to check the doc for 5.3.2 : either this version did not have yet this option or the wrapper I use skipped this parameter.
Post Reply

Who is online

Users browsing this forum: No registered users and 12 guests