🧭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:falseif gizmo cannot be opened (NUI already focused) or entity is invalidOn success, returns a table with:
placed(boolean): true if edit was confirmed and object placed, false if cancelledposition(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
Prevents multiple simultaneous gizmo sessions (returns false if NUI already focused)
Validates entity existence before proceeding
Captures initial entity state (position, rotation)
Opens NUI gizmo interface for interactive editing
Blocks most player controls during gizmo operation (except camera when right-click held)
Synchronizes game camera with UI during operation
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