Skip to content

CircleCollider

namespace Griff.Scenes;
public sealed class CircleCollider : Collider

A circle for collisions, centered on the entity (plus Offset). Its radius grows with the larger of the transform’s X and Y scale, so it stays round. Good for balls, coins, bullets and round enemies.

Circle bodies don’t roll unless their BodyRotates: one resting on a corner stays balanced there. One that rotates rolls: along the ground, down slopes and over tile floors without slipping, slowed by its RollingResistance until it rests, with its spin carried into its bounces and its sprite turning as it goes.

This is a component: its saved properties are on its component page.

public override string? IgnoreLayers { get; set; }
public override bool IsTrigger { get; set; }
public override string? Layer { get; set; }
public override Vector2 Offset { get; set; }
public float Radius { get; set; }

World units before the transform’s scale. 0.5 fits a 1×1 sprite.

public override Box WorldBounds { get; }
public Circle WorldCircle { get; }

The circle it covers in the world. Its radius scales with the larger of the entity’s X and Y scale.

public override bool Contains(Vector2 point)