class

CP::Shape::Box

Inherits CP::Shape::Poly / Indexable / Enumerable / Iterable / Enumerable / CP::Shape / Reference / Object

A special case of a polygon - a rectangle.

The boxes will always be centered at the center of gravity of the body you are attaching them to. If you want to create an off-center box, you will need to use Poly.

Constructors

new(body : Body | Nil, width : Number, height : Number, radius : Number = 0)

Initialize a box shaped polygon shape with rounded corners.

Source
new(body : Body | Nil, box : BB, radius : Number = 0)

Initialize an offset box shaped polygon shape with rounded corners.

Source

Class methods

moment(m : Number, width : Number, height : Number) : Float64

Calculate the moment of inertia for a solid box.

Source
moment(m : Number, box : BB) : Float64

Calculate the moment of inertia for a solid box.

Source