Class b2CircleShape

A circle shape.

Hierarchy

Index

Constructor methods

Methods

Constructor methods

constructor(radius?: number): b2CircleShape

Creates a new circle shape.

Parameters

  • radius?: number optional

    Circle radius.

Returns

b2CircleShape

Methods

public ComputeAABB(aabb: b2AABB, xf: b2Transform)

Given a transform, compute the associated axis aligned bounding box for this shape.

Parameters

  • aabb: b2AABB

    Calculated AABB, this argument is out.

  • xf: b2Transform

    Transform to calculate the AABB.

public ComputeMass(massData: b2MassData, density: number)

Compute the mass properties of this shape using its dimensions and density. The inertia tensor is computed about the local origin, not the centroid.

Parameters

  • massData: b2MassData

    Calculate the mass, this argument is out.

  • density: number

public ComputeSubmergedArea(normal: b2Vec2, offset: number, xf: b2Transform, c: b2Vec2): number

Compute the volume and centroid of this shape intersected with a half plane

Parameters

  • normal: b2Vec2

    The surface normal.

  • offset: number

    The surface offset along the normal.

  • xf: b2Transform

    The shape transform.

  • c: b2Vec2

    The centroid, this argument is out.

Returns

number

public Copy(): b2CircleShape

Copies the circle shape.

Returns

b2CircleShape

Copy of this circle shape.

public GetLocalPosition(): b2Vec2

Get the local position of this circle in its parent body.

Returns

b2Vec2

This circle's local position.

public GetRadius(): number

Get the radius of the circle.

Returns

number

This circle's radius.

public GetType(): number

Get the type of this shape. You can use this to down cast to the concrete shape.

Returns

number

public RayCast(output: b2RayCastOutput, input: b2RayCastInput, transform: b2Transform): boolean

Cast a ray against this shape.

Parameters

Returns

boolean

True if the ray hits the shape, otherwise false.

public Set(other: b2CircleShape)

Set the circle shape values from another shape.

Parameters

  • other: b2CircleShape

    The other circle shape to copy values from.

public SetLocalPosition(position: b2Vec2)

Set the local position of this circle in its parent body.

Parameters

  • position: b2Vec2

    The new local position of this circle.

public SetRadius(radius: number)

Set the radius of the circle.

Parameters

  • radius: number

    The new radius of the circle.

public TestPoint(xf: b2Transform, p: b2Vec2): boolean

Test a point for containment in this shape. This only works for convex shapes.

Parameters

  • xf: b2Transform

    Shape world transform.

  • p: b2Vec2

    Point to test against, in world coordinates.

Returns

boolean

True if the point is in this shape, otherwise false.