chain

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

Utility builder method for constructing fixtures with ChainShape.

Return

FixtureDefinition with Fixture properties.

Parameters

vertices

will be converted to ChainShape points.

init

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

See also

ChainShape.createChain

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

Utility builder method for constructing fixtures with 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. 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.createChain

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

Utility builder method for constructing fixtures with ChainShape.

Return

FixtureDefinition with Fixture properties.

a fully constructed Fixture with ChainShape.

Parameters

vertices

will be converted to ChainShape points.

init

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

See also

ChainShape.createChain

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

Utility builder method for constructing fixtures with 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 ChainShape.

Parameters

vertices

will be converted to ChainShape points. 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.createChain