Page 1 of 1

chipmunk pro 7.0 questions

Posted: Sun Jan 04, 2015 11:22 am
by dugbug
There are a ton of API changes. I understand the docs are not ready yet. Some of them are obvious (x.pos became x.position) but chipmunkExtras.h has been neutered in this release (presumably absorbed?) and a lot of support APIs I cannot find such as
[body resetForces]
[body isRogue]

Also just to check I assume body.affineTransform from chipmunkExtras became just body.transform.

reset forces used to zero out force and torque. Im not sure if this fully replicates that API but is this ok:
body.force = cpvzero;
body.torque=0.0;

isRogue was used to see if a body was in a space or not. I used it to sanity-check some stuff. Can we just test the space attribute for nil?
body.space

Then there is [space addBounds] which signature has changed quite a bit. Why not use CGRect anymore? At least provide a convenience routine.

Re: chpro 7.0 questions

Posted: Sun Jan 04, 2015 11:34 am
by dugbug
Also, how do I interpret cpContactPointSet? It used to look like this:

struct {
/// The position of the contact point.
cpVect point;
cpVect normal;
cpFloat dist;
} points[CP_MAX_CONTACTS_PER_ARBITER];

and now looks like this:

struct {
/// The position of the contact on the surface of each shape.
cpVect pointA, pointB;
cpFloat distance;
} points[CP_MAX_CONTACTS_PER_ARBITER];

I want the position of the contact point per the old API. Is "pointA" that point?

Re: chipmunk pro 7.0 questions

Posted: Sun Feb 12, 2017 4:04 pm
by dugbug
bump

Re: chipmunk pro 7.0 questions

Posted: Sun Feb 12, 2017 4:51 pm
by dugbug
Figured the addBounds question. This is how to convert cgrect to cpBB and what to do with filter vs layers/group:

cpBB bds;
bds.l = bounds.origin.x;
bds.r = bounds.origin.x + bounds.size.width;
bds.b = bounds.origin.y;
bds.t = bounds.origin.y + bounds.size.height;
[space addBounds:bds
thickness:1000.0f
elasticity:1.0f
friction:1000.0f
filter:CP_SHAPE_FILTER_ALL
//layers:CP_ALL_LAYERS
//group:CP_NO_GROUP
collisionType:borderType];