ShapeDef

data class ShapeDef(val density: Float = 1.0f, val friction: Float = 0.6f, val restitution: Float = 0.0f, val rollingResistance: Float = 0.0f, val tangentSpeed: Float = 0.0f, val filter: Filter = Filter.Default, val isSensor: Boolean = false, val enableSensorEvents: Boolean = false, val enableContactEvents: Boolean = false, val enableHitEvents: Boolean = false, val enablePreSolveEvents: Boolean = false, val invokeContactCreation: Boolean = true, val updateBodyMass: Boolean = true)

Definition for creating a shape. Default values match Box2D's b2DefaultShapeDef().

Constructors

Link copied to clipboard
constructor(density: Float = 1.0f, friction: Float = 0.6f, restitution: Float = 0.0f, rollingResistance: Float = 0.0f, tangentSpeed: Float = 0.0f, filter: Filter = Filter.Default, isSensor: Boolean = false, enableSensorEvents: Boolean = false, enableContactEvents: Boolean = false, enableHitEvents: Boolean = false, enablePreSolveEvents: Boolean = false, invokeContactCreation: Boolean = true, updateBodyMass: Boolean = true)

Properties

Link copied to clipboard

The density, usually in kg/m^2.

Link copied to clipboard

Enable contact events for this shape. Only applies to kinematic and dynamic bodies. Ignored for sensors.

Link copied to clipboard

Enable hit events for this shape. Only applies to kinematic and dynamic bodies. Ignored for sensors.

Link copied to clipboard

Enable pre-solve contact events for this shape. Only applies to dynamic bodies. These are expensive and must be carefully handled due to threading. Ignored for sensors.

Link copied to clipboard

Enable sensor events for this shape. False by default, even for sensors.

Link copied to clipboard

Collision filtering data.

Link copied to clipboard

The Coulomb (dry) friction coefficient, usually in the range 0,1.

Link copied to clipboard

When true, the shape will trigger a contact creation callback even if the collision filter would normally prevent it. This is useful for custom filtering.

Link copied to clipboard

A sensor shape generates overlap events but never generates a collision response. Sensors do not have continuous collision. Sensors still contribute to the body mass if they have non-zero density.

Link copied to clipboard

The coefficient of restitution (bounce) usually in the range 0,1.

Link copied to clipboard

The rolling resistance, usually in the range 0,1.

Link copied to clipboard

The tangent speed for conveyor belt behavior in meters per second.

Link copied to clipboard

When true, adding/removing this shape will automatically update the body mass properties. Set to false if you want to manually call applyMassFromShapes().