Skip to content

@modoki/engine / index / RigidBody2D

Variable: RigidBody2D

const RigidBody2D: Trait<{ angularDamping: number; angularVel: number; bodyType: BodyType2D; canSleep: boolean; ccd: boolean; fixedRotation: boolean; gravityScale: number; isSleeping: boolean; linearDamping: number; vx: number; vy: number; }>

The motion half of a 2D physics entity (pair with Collider2D for a shape). Velocities are in world units/s and radians/s (screen frame, Y-down); the physics system converts them to Rapier's meter/Y-up frame via Physics2D.pixelsPerMeter. The velocity fields are read-back each frame for dynamic bodies (runtimeOnly).

Built with Modoki.