Skip to content

@modoki/engine / index / Collider2D

Variable: Collider2D

const Collider2D: Trait<{ collisionGroups: number; collisionMask: number; density: number; friction: number; halfH: number; halfW: number; isSensor: boolean; physicsLayer: string; points: string; radius: number; restitution: number; shape: ColliderShape2D; }>

The shape/material half of a 2D physics entity. REQUIRES a RigidBody2D on the same entity OR a rigidbody ancestor (then adopted as a compound collider). A lone Collider2D with neither creates no Rapier collider and fires no events (the physics system warns once); for a static wall/sensor pair it with RigidBody2D({ bodyType: 'static' }). Dimensions are in WORLD UNITS (same space as Transform/Renderable2D), converted to Rapier meters via Physics2D.pixelsPerMeter. Collider dims do NOT currently scale with Transform.scale (Phase 1) — size the collider directly.

collisionGroups/collisionMask are 16-bit membership/filter bitmasks: two colliders interact only if each one's group is in the other's mask.

Built with Modoki.