MODULE v1.8.0

physics

pykraken.physics

Physics engine related classes and functions

Reference

PYTHON API

fixed_steps

function
fixed_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() -> float

Get the current fixed delta time for physics stepping.

Returns

  • float — The fixed time step in seconds.
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(fixed_delta: float) -> None

Set 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(max_substeps: int) -> None

Set 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.

Find your next step

Start typing to search the manual.