Skip to content
Work in progress. These docs describe Spawnite at launch, and some parts are still being built.

usePointerPlanePoint

usePointerPlanePoint(): RefObject<Readonly<AimPoint> | null>

The point on the scene’s 2D plane under the pointer, in a ref the page reads each frame, such as to face a top-down character toward the mouse with setPlayerAim. The frame writes it after the camera moves, so a still pointer over a moving camera reads a moving point; through the camera as it shows, shake and all, as Weapon aims. A captured cursor reads the screen’s middle. A touch reads a point only while the finger that went down on the canvas stays down, so a finger on a touch control moves none. Null before the pointer first moves, once it leaves the page or a touch lifts, over a cropped frame’s bars, while no Camera2D draws, and while a devtools camera holds the view. Feed it to setPlayerAim each frame, null included, so the character stops aiming as the pointer leaves. Godot’s get_global_mouse_position and Phaser’s pointer.worldX.

RefObject<Readonly<AimPoint> | null>