gravity

fun Body.gravity(configure: GravityForce.() -> Unit): Boolean(source)

Adds a gravitational force to the body and allows configuring its properties.

This method attaches a new instance of GravityForce to the body, applying a constant gravitational acceleration defined in the configuration block. The force affects all nodes in the body during simulation steps.

Parameters

configure

a lambda to configure the properties of the GravityForce instance, such as setting the gravitational acceleration vector.


Applies a gravitational force to the body by adding it to the list of forces acting on the body.

Parameters

gravity

the gravitational force to be applied, represented as a GravityForce instance.