The global mouse object stores the current mouse state inside the canvas.
It includes its position, click status and wheel scrolling.
It is accessible from any script.
true if the mouse button is pressed.true if the mouse button was released.if (mouse.down) {
console.log("Click at:", mouse.x, mouse.y);
}
// Get world position
const worldPos = ScreenToWorld(mouse.x, mouse.y);
console.log("World position:", worldPos.x, worldPos.y);
ScreenToWorld() to get accurate world coordinates when the camera moves.