class

CP::Shape::Circle

Inherits CP::Shape / Reference / Object

A circle shape defined by a radius

This is the fastest and simplest collision shape

Constructors

new(body : Body | Nil, radius : Number, offset : Vect = CP::Vect.new(0, 0))

The parameters are: the body to attach the circle to; the offset from the body's center of gravity in body local coordinates.

Source

Class methods

area(r1 : Number, r2 : Number) : Float64

Calculate area of a hollow circle.

r1 and r2 are the inner and outer diameters. A solid circle has an inner diameter of 0.

Source
moment(m : Number, r1 : Number, r2 : Number, offset : Vect = CP::Vect.new(0, 0)) : Float64

Calculate the moment of inertia for a circle.

r1 and r2 are the inner and outer diameters. A solid circle has an inner diameter of 0.

Source

Instance methods

offset

Get the offset of a circle shape.

Source
offset=(offset : Vect)

Unsafe. Set the offset of a circle shape.

This change is only picked up as a change to the position of the shape's surface, but not its velocity. Changing it will not result in realistic physical behavior. Only use if you know what you are doing!

Source
radius

Get the radius of a circle shape.

Source
radius=(radius : Number)

Unsafe. Set the radius of a circle shape.

This change is only picked up as a change to the position of the shape's surface, but not its velocity. Changing it will not result in realistic physical behavior. Only use if you know what you are doing!

Source