struct

Flock::Collision::Collider2D

Inherits Flock::Component < Struct < Value < Object

A 2D collision shape attached to an entity, alongside a Flock::Transform2D (which supplies world position + rotation). One component type for every shape; shape selects how half/radius are read: Circle -> radius Box -> half = half-extents (x, y) Capsule -> radius + half-height in half.y (segment along local Y)

layer/mask are bitfields for collision filtering; sensor reports contacts (events) but is skipped by the resolver.

Constants

ALL_LAYERS = 4294967295_u32

Constructors

box(half_width : Number, half_height : Number, layer : UInt32 = ALL_LAYERS, mask : UInt32 = ALL_LAYERS, sensor : Bool = false) : Collider2D
Source
capsule(radius : Number, half_height : Number, layer : UInt32 = ALL_LAYERS, mask : UInt32 = ALL_LAYERS, sensor : Bool = false) : Collider2D
Source
circle(radius : Number, layer : UInt32 = ALL_LAYERS, mask : UInt32 = ALL_LAYERS, sensor : Bool = false) : Collider2D
Source
new(shape : Shape2D = Shape2D::Circle, half : Flock::Vec2 = Flock::Vec2.new, radius : Number = 0.5, layer : UInt32 = ALL_LAYERS, mask : UInt32 = ALL_LAYERS, sensor : Bool = false)
Source

Class methods

component_id

Instance methods

collides_with?(o : Collider2D) : Bool

Do these two colliders' layer/mask bits permit a contact? (symmetric)

Source
half
Source
half=(half : Flock::Vec2)
Source
layer
Source
layer=(layer : UInt32)
Source
mask
Source
mask=(mask : UInt32)
Source
radius
Source
radius=(radius : Float32)
Source
sensor
Source
sensor=(sensor : Bool)
Source
shape
Source
shape=(shape : Shape2D)
Source