physics
pykraken.physics Physics engine related classes and functions
At a glance
5 membersReference
PYTHON APIfixed_steps
functionfixed_steps() -> list[float]Consume accumulated frame time and return a sequence of fixed deltas in seconds. Call once per frame and update gameplay and step each world inside the same loop. This function never advances a world itself. At most eight steps are returned; excess catch-up time is discarded. Repeated calls without advancing frame timing return no additional steps.
get_fixed_delta
functionget_fixed_delta() -> floatGet the current fixed delta time for physics stepping.
Returns
- float — The fixed time step in seconds.
get_max_substeps
functionget_max_substeps() -> intGet the current maximum number of substeps for physics stepping.
Returns
- int — The number of substeps per time step.
set_fixed_delta
functionset_fixed_delta(fixed_delta: float) -> NoneSet the positive, finite timestep yielded by fixed_steps(). Default: 1/60 seconds. Changing the timestep clears accumulated time. This does not enable automatic stepping.
set_max_substeps
functionset_max_substeps(max_substeps: int) -> NoneSet the physics solver substeps used by each World.step() call. Default is 4. This does not change the eight-step fixed_steps() catch-up limit.
Args
- max_substeps (
int) — The number of substeps per time step.