loop

inline fun BodyDefinition.loop(vararg vertices: Vector2, init: FixtureDefinition.(ChainShape) -> Unit = {}): FixtureDefinition

Utility builder method for constructing fixtures with looped ChainShape.

Return

FixtureDefinition with Fixture properties.

Parameters

vertices

will be converted to ChainShape points. Will be looped.

init

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

See also

ChainShape.createLoop

inline fun BodyDefinition.loop(vertices: FloatArray, init: FixtureDefinition.(ChainShape) -> Unit = {}): FixtureDefinition

Utility builder method for constructing fixtures with looped ChainShape. Note that this method consumes a FloatArray instead of array of Vector2 instances, which might be less readable, but creates slightly less garbage. This method is advised to be used instead of the Vector2-consuming variant on mobile devices.

Return

FixtureDefinition with Fixture properties.

Parameters

vertices

will be converted to ChainShape points. Will be looped. Each two adjacent numbers represent a point's X and Y.

init

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

See also

ChainShape.createLoop

inline fun Body.loop(vararg vertices: Vector2, init: FixtureDefinition.(ChainShape) -> Unit = {}): Fixture

Utility builder method for constructing fixtures with looped ChainShape.

Return

a fully constructed Fixture with looped ChainShape.

Parameters

vertices

will be converted to ChainShape points. Will be looped.

init

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

See also

ChainShape.createLoop

inline fun Body.loop(vertices: FloatArray, init: FixtureDefinition.(ChainShape) -> Unit = {}): Fixture

Utility builder method for constructing fixtures with looped ChainShape. Note that this method consumes a FloatArray instead of array of Vector2 instances, which might be less readable, but creates slightly less garbage. This method is advised to be used instead of the Vector2-consuming variant on mobile devices.

Return

a fully constructed Fixture with looped ChainShape.

Parameters

vertices

will be converted to ChainShape points. Will be looped. Each two adjacent numbers represent a point's X and Y.

init

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

See also

ChainShape.createLoop