Skip to content

Collider

namespace Griff.Scenes;
public abstract class Collider : Component

A shape for collisions: a BoxCollider, a CircleCollider or a PolygonCollider. Without a Body the shape is static: walls, floors, platforms. Use GetComponent<Collider>() to find any kind.

public abstract string? IgnoreLayers { get; set; }

Layers this collider passes through, e.g. “Bullet, Enemy”: no blocking, no collisions, no triggers. It works both ways, so only one side has to list the other.

public abstract bool IsTrigger { get; set; }

Triggers don’t block movement; they report OnTriggerEnter/Exit instead.

public abstract string? Layer { get; set; }

A name for what kind of thing this is, e.g. “Player”, “Enemy” or “Bullet”, for IgnoreLayers and physics queries. Empty is the “Default” layer.

public abstract Vector2 Offset { get; set; }

How far the shape’s center is from the entity, before the transform’s scale.

public bool Turns { get; }

True when the shape turns with its entity: its Body (the entity’s own, or else the nearest one it’s inside) Rotates. Otherwise it stays upright whatever the entity’s rotation, as colliders always have.

public abstract Box WorldBounds { get; }

The box around the shape in the world, from its entity’s position and scale; for a shape that Turns, the box round it as it’s turned.

public abstract bool Contains(Vector2 point)

True if point (in the world) is inside the shape, turned if it Turns.

public void HoldOut(long step)

Holds it out of the world for the step step (its scene’s Step): a slingshot’s shot waiting its turn or in the pouch. That step nothing bumps into it and it bumps into nothing; hold it again each step it’s held.