Page 1 of 1

ChipmunkPolyShape Box Offset

Posted: Mon Nov 26, 2012 7:45 am
by cocojoe
Maybe this is a stupid question however I wondered why there is no convenience offset param for:

Code: Select all

/// Create an autoreleased box shape centered on the center of gravity.
+ (id)boxWithBody:(ChipmunkBody *)body width:(cpFloat)width height:(cpFloat)height;
As ChipmunkCirlceShape has an offset param for the equivalent method.

Code: Select all

/// Create an autoreleased circle shape with the given radius and offset from the center of gravity.
+ (id)circleWithBody:(ChipmunkBody *)body radius:(cpFloat)radius offset:(cpVect)offset;

Re: ChipmunkPolyShape Box Offset

Posted: Mon Nov 26, 2012 1:33 pm
by slembcke
There is an alternate version that allows you to specify a bounding body instead of just width/height. It wasn't there originally because the box creation method was just a convenience method to create a four sided polygon for you. Creating a centered box was the most common usage, so I did that first.