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.
chipmunk pro 7.0 questions
-
- Posts: 20
- Joined: Fri Jan 06, 2012 10:08 am
- Contact:
chipmunk pro 7.0 questions
Last edited by dugbug on Sun Jan 04, 2015 3:55 pm, edited 2 times in total.
-
- Posts: 20
- Joined: Fri Jan 06, 2012 10:08 am
- Contact:
Re: chpro 7.0 questions
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?
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?
-
- Posts: 20
- Joined: Fri Jan 06, 2012 10:08 am
- Contact:
-
- Posts: 20
- Joined: Fri Jan 06, 2012 10:08 am
- Contact:
Re: chipmunk pro 7.0 questions
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];
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];
Who is online
Users browsing this forum: No registered users and 6 guests