cpBB confusion (CGRect relationship)

Official forum for the Chipmunk2D Physics Library.

cpBB confusion (CGRect relationship)

Postby dugbug » Sun Jan 11, 2015 3:42 pm

Hi, with v7 objective-chipmunk users have to use cpbb instead of cgrect when using [space addSpace] but cpbb is not explained very well. It takes four arguments but what they reference is not clear: left, bottom, right, and top.

I get a single field called .... 'left'? what is left, distance from the center? For some reason I landed on this combination that seems to work but would appreciate confirmation from anybody that has done this.

cpbb.l = bounds.origin.x;
cpbb.b = bounds.origin.y;
cpbb.r = bounds.size.width;
cpbb.t = bounds.size.height;

Posts: 20
Joined: Fri Jan 06, 2012 10:08 am

Return to Chipmunk2D Physics

Who is online

Users browsing this forum: No registered users and 1 guest