Thank you for taking the time to read my post.
I have read several posts about the ordering of verts, it is stated in these postes and the documentation that verts should be listed in clockwise order and must be convex. I am making a shape from two rectangles, the simulation does not work when I provide the verts array with element 0 as top left then element 1 as top right and element 2 as bot right and element 3 as bot left. So I am posting to ask assistance to solve my problem. I am running Chipmunk-6.0.1.
Firtsly I would like to ask if it is okay to start my rectangle at 0, 0 for top left like so:
Code: Select all
cpVect shapeVerts[ 4 ];
shapeVerts[ 0 ] = cpv( 0, 0 );
shapeVerts[ 1 ] = cpv( shapeWidth, 0 );
shapeVerts[ 2 ] = cpv( shapeWidth, shapeHeight );
shapeVerts[ 3 ] = cpv( 0, shapeHeight );
cpSpaceAddShape( theSpace, cpPolyShapeNew( theBody, 4, shapeVerts, cpv( -30, 0 ) ) );
Thirdly, is there a coarse of logic I can follow to try and resolve my unshapley shapes, we currently have a working simulation with co-ordinates cerntered over the center of gravity then offset into place starting from top left to bot left, bot right and then to top right which I assume is counter clockwise, now I know this is wrong and I worry that it may cause problems in the future and hiding something that is wrong with existing code. Since we are only dealing in combinations of rectangles I am assuming I am not falling prey to concave issues.