Physics

Physics engine related classes and functions

Experimental API:

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


Get Fixed Delta

get_fixed_delta() float

Get the current fixed delta time for physics stepping.

Returns

float : The fixed time step in seconds.

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.

Set Fixed Delta

set_fixed_delta(fixed_delta: SupportsFloat) 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.

Set Max Substeps

set_max_substeps(max_substeps: SupportsInt) None

Set the maximum number of substeps for physics stepping.

Args

  • max_substeps : The number of substeps per time step.