Commands
The createMove event contains a short-lived command:
import { events } from "fumo:events";
events.on("createMove", ({ command }) => {
const angles = command.getViewAngles();
if (angles) {
command.setViewAngles({ ...angles, y: angles.y + 5 });
}
});
Writing requires the input.write capability. Reads are allowed without it.
Pitch, yaw, and roll are normalized and clamped natively.
The object expires immediately after that callback returns. It is already invalid in a Promise continuation, timer, another event callback, or a later command:
events.once("createMove", ({ command }) => {
Promise.resolve().then(() => {
console.log(command.isValid()); // false
});
});
Copy values you need; never retain the command object.