ForceSimulation
Represents a physics simulation of interacting bodies.
The ForceSimulation class provides the infrastructure to simulate the dynamics of a system of bodies under the influence of forces and constraints. It supports customizable interbody forces, collision detection, and resolution, allowing for a wide variety of physical interactions.
Properties
The list of Body objects participating in the simulation. Each body has its own properties, forces, and constraints that determine its behavior.
The collision detection algorithm used to identify potential overlapping pairs of bodies during the simulation. It operates in the broad-phase stage of collision resolution.
The collision resolution handler responsible for determining the outcome of detected collisions between bodies.
The coroutine context in which the simulation runs, allowing for asynchronous computations. By default, it uses Dispatchers.Default.
A list of interbody forces that affect pairs of bodies in the simulation. These forces are computed per pair of bodies and influence their dynamics.
Functions
Configures the force simulation to use the naive broad-phase collision detection algorithm.
Adds a NodeRepulseInterbodyForce to the list of interbody forces in the simulation.
Adds a repulsive interbody force using a bounding volume hierarchy (BVH) to the simulation.
Sets the collision resolution handler to a sweep-and-prune (SAP) based collision constraint.