GravityForce

Represents a constant gravitational force applied to a physical body in a simulation.

The GravityForce class is a specific implementation of the Force interface. It applies a constant acceleration, defined by the gravity vector, to all nodes of the body over time. The force is applied during every simulation frame, updating the velocity of the nodes based on the gravitational vector and the elapsed time step.

Constructors

Link copied to clipboard
constructor()

Properties

Link copied to clipboard
var gravity: Vector2

the gravitational acceleration vector applied to the body. Default value is Vector2.ZERO, indicating no gravity unless explicitly configured.

Functions

Link copied to clipboard
open suspend override fun apply(body: Body, dt: Double)
Link copied to clipboard
open suspend override fun initializeFrame(body: Body)