BoxCollider
namespace Griff.Scenes;
public sealed class BoxCollider : ColliderA box for collisions, centered on the entity (plus Offset) and scaled by its transform. It stays upright whatever the entity’s rotation, unless its BodyRotates: then it turns with the entity. Without a Body the box is static: walls, floors, platforms.
This is a component: its saved properties are on its component page.
Properties
Section titled “Properties”IgnoreLayers
Section titled “IgnoreLayers”public override string? IgnoreLayers { get; set; }IsTrigger
Section titled “IsTrigger”public override bool IsTrigger { get; set; }public override string? Layer { get; set; }Offset
Section titled “Offset”public override Vector2 Offset { get; set; }OneWay
Section titled “OneWay”public bool OneWay { get; set; }Only blocks bodies landing on top: jump up through it from below, stand on it from above.
public Vector2 Size { get; set; }Width and height, in world units before the transform’s scale.
WorldBounds
Section titled “WorldBounds”public override Box WorldBounds { get; }WorldBox
Section titled “WorldBox”public Box WorldBox { get; }The box it covers in the world, from its entity’s position and scale. One that Turns is the box round it as it’s turned (see WorldShape for the turned box itself).
WorldCorners
Section titled “WorldCorners”public ValueTuple<Vector2, Vector2, Vector2, Vector2> WorldCorners { get; }Its four corners in the world, anticlockwise from the bottom left (as it’s turned, if it Turns).
WorldShape
Section titled “WorldShape”public ValueTuple<Vector2, Vector2, Vector2> WorldShape { get; }The box in the world as it is: its middle, half its width and height, and which way its own X axis points (a unit vector, (1, 0) unless it Turns; its Y axis is that turned a quarter anticlockwise).
Methods
Section titled “Methods”Contains
Section titled “Contains”public override bool Contains(Vector2 point)