BallCollider

The BallCollider component defines a circular collision shape. It can be used for physics interactions and collision detection. See Physics for an overview.

Options

OptionTypeDefaultDescription
radiusnumber0Radius of the circle.
offsetVector2(0, 0)Offset from the entity’s position.
layerstring""The collision layer the collider belongs to.
physicsbooleantrueIf true, the collider interacts with rigid bodies.
ignoreCollisionsWithLayersstring[][]Layers this collider ignores.

Example

import { Transform, BallCollider } from "angry-pixel";

this.entityManager.createEntity([
    new Transform(),
    new BallCollider({ radius: 8, layer: "Ball" }),
]);

Add a RigidBody to the same entity to make it move and respond to physics.