A timer that counts simulated time, one physics step at a time. More...
| Import Statement: | import Clayground.Physics |
PhysicsTimer has the interface of a QML Timer, but its clock is the physics world: after every step it adds the step's time to elapsed and fires once that reaches interval. A pause fires nothing, single-stepping fires after as many steps as the interval takes, a hit stop or a lower time scale slows it exactly as much as the simulation.
Example usage:
import Clayground.Physics PhysicsTimer { world: theWorld.physics interval: 800 repeat: true running: true onTriggered: enemy.decide() }
The Box2D world whose steps drive the timer. Inside a ClayWorld2d this is its physics property.
Simulated milliseconds between start and trigger (default 1000).
Whether the timer counts steps.
Whether the timer fires again after each interval, carrying over the time a step overshot it.
Whether starting the timer fires it right away as well.
Simulated milliseconds since the timer started or last fired.
Emitted when interval simulated milliseconds have passed.
Starts the timer.
Stops the timer.
Starts the timer over from zero, running or not.