🧭lvs-gizmo

Gizmo

exports.lvs_gizmo:useGizmo() opens an interactive gizmo UI for editing an entity's position and rotation.

Parameters

  • entityData (table|string|number):

    • If string/number: treated as entity handle

    • If table: should contain at least handle (entity handle), optionally:

      • label (string): display name for the entity (defaults to 'Unknown')

      • hash (number): model hash (defaults to GetEntityModel(handle))

      • model (string): model name (defaults to 'Unknown')

      • image (any): optional image data for UI

Returns

  • boolean|table:

    • false if gizmo cannot be opened (NUI already focused) or entity is invalid

    • On success, returns a table with:

      • placed (boolean): true if edit was confirmed and object placed, false if cancelled

      • position (vector3): final position coordinates (only when placed=true)

      • rotation (vector3): final rotation coordinates (only when placed=true)

      • initialCords (table): contains initial position and rotation: -> position (vector3): initial position before edit -> rotation (vector3): initial rotation before edit

Usage Example

Behavior

  1. Prevents multiple simultaneous gizmo sessions (returns false if NUI already focused)

  2. Validates entity existence before proceeding

  3. Captures initial entity state (position, rotation)

  4. Opens NUI gizmo interface for interactive editing

  5. Blocks most player controls during gizmo operation (except camera when right-click held)

  6. Synchronizes game camera with UI during operation

  7. On completion:

    • If confirmed ("placed"): returns updated position/rotation plus initial values

    • If cancelled: returns false for placed flag but still provides initial values for restoration

    • Always clears NUI focus and resets gizmo entity reference

Last updated