For the complete documentation index, see llms.txt. This page is also available as Markdown.

Gizmo


📦 Exports

StartGizmo

Initializes the 3D Gizmo interface, spawning a dummy entity (if provided) and locking focus to the NUI for precise manipulation.

Syntax:

Parameters:

Parameter

Type

Required

Description

options

table

Yes

Configuration table for the Gizmo deployment.

callback

function

Yes

Triggers continuously on positional updates, and once upon closing or cancelling.

options Table Breakdown:

Key

Type

Default

Description

model

string / hash

nil

The model name or hash to spawn as the visual dummy prop.

coords

vector3

N/A

The starting coordinates for the Gizmo.

rot

vector3

vector3(0,0,0)

The starting rotation for the Gizmo.

Callback Event Types (result.event):

  • update: Fires constantly as the player moves the object via the NUI. Returns raw axis data (x, y, z, rotX, rotY, rotZ).

  • closed: Fires when the player confirms the placement. Returns coords and rot as vector3.

  • cancelled: Fires when the player cancels the placement. Returns the initial starting coords and rot as vector3.


StopGizmo

Programmatically stops the active Gizmo session. This is typically handled internally by the NUI, but can be forced via code if required (e.g., if a player is killed or restrained while placing an item).

Syntax:

Parameters:

Parameter

Type

Required

Description

isCancel

boolean

Yes

true aborts placement and returns the object to its starting position. false confirms the current placement.


🎮 Player Controls

When the Gizmo is active, the library handles the following native inputs automatically to ensure a smooth user experience:

  • Right Mouse Button (Hold): Temporarily hides the cursor and disables player firing/aiming, allowing the user to free-look with the camera while keeping the Gizmo open.

  • Bounding Box: A visual 3D bounding box automatically renders around the active dummy prop to help users visualize the physical footprint.


💻 Complete Example Implementation

Below is a fully functional client-side script utilizing the Gizmo export to spawn, move, and finalize a networked prop.

Last updated