WorldDef

data class WorldDef(val gravity: Vec2 = Vec2(0f, -10f), val restitutionThreshold: Float = 1.0f, val hitEventThreshold: Float = 1.0f, val contactHertz: Float = 30.0f, val contactDampingRatio: Float = 10.0f, val maxContactPushSpeed: Float = 3.0f, val maximumLinearSpeed: Float = 400.0f, val enableSleep: Boolean = true, val enableContinuous: Boolean = true)

Definition for creating a physics world. Default values match Box2D's b2DefaultWorldDef().

Constructors

Link copied to clipboard
constructor(gravity: Vec2 = Vec2(0f, -10f), restitutionThreshold: Float = 1.0f, hitEventThreshold: Float = 1.0f, contactHertz: Float = 30.0f, contactDampingRatio: Float = 10.0f, maxContactPushSpeed: Float = 3.0f, maximumLinearSpeed: Float = 400.0f, enableSleep: Boolean = true, enableContinuous: Boolean = true)

Properties

Link copied to clipboard

Contact bounciness. Lower values speed up overlap recovery but make resolution more energetic.

Link copied to clipboard

Contact stiffness (cycles per second). Higher values increase overlap recovery speed but may cause jitter.

Link copied to clipboard

Enable continuous collision detection to prevent fast bodies from tunneling through thin objects.

Link copied to clipboard

Can bodies go to sleep to improve performance.

Link copied to clipboard

Gravity vector. Box2D has no up-vector defined.

Link copied to clipboard

Threshold speed for hit events (m/s).

Link copied to clipboard

Maximum speed for contact push-out resolution (m/s).

Link copied to clipboard

Maximum linear speed for bodies (m/s). Default is 400 (faster than speed of sound).

Link copied to clipboard

Restitution speed threshold (m/s). Collisions above this speed have restitution applied (will bounce).