Prediction: settled property
Available since
@irtio/client 5.0BrowsersNodeThe settled read-only property of the Prediction interface says whether the prediction agrees with the room: entity equals the room’s last state of it, so the inputs the room hasn’t acknowledged move nothing.
Value
A boolean. It’s false until the predicted entity is found.
Description
settled compares every field of the entity, so a player standing still with nothing pending is settled, and one who is moving is not. render() may still be smoothing away an earlier misprediction while settled is true.
In tests, wait for settled to know the prediction has caught up, since pending never reaches 0 while the prediction samples.
Examples
Enabling a button once the player stands still
A building game lets the player place a block only while its predicted position matches the room’s, so the block lands where they see it.
// place.ts
import type { Prediction } from "@irtio/client";
export function updatePlaceButton(me: Prediction<unknown>, button: HTMLButtonElement): void {
button.disabled = !me.settled;
}
See also
Prediction.pendingPrediction.drift- Testing in Client prediction
Runtime availability
| Browsers | Node | |
|---|---|---|
settled | 5.0 | 5.0 |