ChipmunkPolyShape Box Offset

Discuss new features and future development.

ChipmunkPolyShape Box Offset

Postby cocojoe » Mon Nov 26, 2012 7:45 am

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;
Posts: 13
Joined: Thu Mar 08, 2012 8:56 am

Re: ChipmunkPolyShape Box Offset

Postby slembcke » Mon Nov 26, 2012 1:33 pm

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.
Can't sleep... Chipmunks will eat me...
Check out our latest projects! ->
User avatar
Site Admin
Posts: 4164
Joined: Tue Aug 14, 2007 7:13 pm

Return to Features/Development

Who is online

Users browsing this forum: No registered users and 1 guest