custom shapes

Official forum for the Chipmunk2D Physics Library.

custom shapes

Postby erwan.l » Tue Aug 15, 2017 11:32 am

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
erwan.l
 
Posts: 2
Joined: Tue Aug 15, 2017 11:14 am

Re: custom shapes

Postby aisman » Wed Aug 16, 2017 12:06 am

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. Get it here: http://www.dreifrankensoft.de
User avatar
aisman
 
Posts: 139
Joined: Tue Mar 04, 2008 2:21 am

Re: custom shapes

Postby erwan.l » Wed Aug 16, 2017 11:34 am

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.
erwan.l
 
Posts: 2
Joined: Tue Aug 15, 2017 11:14 am


Return to Chipmunk2D Physics

Who is online

Users browsing this forum: No registered users and 3 guests

cron