box

inline fun BodyDefinition.box(width: Float = 1.0f, height: Float = 1.0f, position: Vector2 = Vector2.Zero, angle: Float = 0.0f, init: FixtureDefinition.(PolygonShape) -> Unit = {}): FixtureDefinition

Utility builder method for constructing fixtures with PolygonShape set as box. Note that - contrary to PolygonShape.setAsBox methods - this method consumes actual not halved box width and height sizes.

Return

FixtureDefinition with Fixture properties.

Parameters

width

width of the box shape. Defaults to 1f.

height

height of the box shape. Defaults to 1f

position

offset of the box position in relation to body center. Defaults to (0f, 0f).

angle

angle of the box in radians. Defaults to 0f.

init

inlined. Allows to modify FixtureDef properties. Receives PolygonShape as first (it) argument.

See also

PolygonShape.setAsBox

inline fun Body.box(width: Float = 1.0f, height: Float = 1.0f, position: Vector2 = Vector2.Zero, angle: Float = 0.0f, init: FixtureDefinition.(PolygonShape) -> Unit = {}): Fixture

Utility builder method for constructing fixtures with PolygonShape set as box. Note that - contrary to PolygonShape.setAsBox methods - this method consumes actual not halved box width and height sizes.

Return

a fully constructed Fixture with box PolygonShape.

Parameters

width

width of the box shape. Defaults to 1f.

height

height of the box shape. Defaults to 1f

position

offset of the box position in relation to body center. Defaults to (0f, 0f).

angle

angle of the box in radians. Defaults to 0f.

init

inlined. Allows to modify FixtureDef properties. Receives PolygonShape as first (it) argument.

See also

PolygonShape.setAsBox