Physics

Functions in physics.

Experimental API:

The physics submodule is a VERY experimental and new API that is highly susceptible to breaking changes in the future.


Set Fixed Delta

set_fixed_delta(fixed_delta: float) None

Set the fixed delta time for automatic physics stepping. Default is 1/60 seconds (60 FPS).

Setting this to a value greater than 0.0 enables automatic physics stepping in the engine backend. The physics will be updated with this fixed time step, using an accumulator to handle variable frame rates.

Args

  • fixed_delta : The fixed time step in seconds (e.g., 1.0/60.0). Set to 0.0 to disable automatic stepping.

Get Fixed Delta

get_fixed_delta() float

Get the current fixed delta time for physics stepping.

Returns

float : The fixed time step in seconds.

Set Max Substeps

set_max_substeps(max_substeps: int) None

Set the maximum number of substeps for physics stepping. Default is 4.

Args

  • max_substeps : The number of substeps per time step.

Get Max Substeps

get_max_substeps() int

Get the current maximum number of substeps for physics stepping.

Returns

int : The number of substeps per time step.