Object Gizmo
Last updated on
A drop-in 3D gizmo for moving, rotating, and optionally scaling entities. exports.object_gizmo:useGizmo(entity) blocks until the player finishes and returns handle, position, and rotation.
Keep the resource folder named object_gizmo. Existing scripts that call exports.object_gizmo:useGizmo keep working. cancelled and confirmed are extra result fields and are safe to ignore.
Features
- Translate, rotate, and optional scale handles drawn with Three.js
- Gameplay camera, or a scripted orbit camera, chosen per call
- World or local space
- Handles on the entity origin, or on the model bounds center
- Snap to ground, grid snap, and copy the transform to the clipboard
- Distance limit and an ox_lib zone bounds limit
- Control strip uses sleepless_prompts when that resource is running, and ox_lib text UI otherwise
- Outline on objects, and a fade on peds
Dependencies
- ox_lib (required)
- sleepless_prompts (optional)
Installation
Download the Resource
Download a release or clone the repository. The gizmo UI is the built web/dist folder. You do not need to build it unless you change web/src.
Add to Server
Place the object_gizmo folder in your server's resources directory.
Configure Your Server
Add the following to your server.cfg, after ox_lib:
ensure ox_lib
ensure object_gizmoStart sleepless_prompts as well if you want the prompt strip. It is not a dependency.
Configure the Resource
Edit config.lua for the defaults every call inherits. See Configuration. Pass a table to useGizmo when one placement needs different settings. See Call Options.
Quick Start
local result = exports.object_gizmo:useGizmo(entity)
if result.confirmed then
print(result.position, result.rotation)
endA number as the second argument is a distance limit, in metres, measured from the entity origin when the gizmo opened:
local result = exports.object_gizmo:useGizmo(entity, 2.5)Switch the camera for a single call without changing config.lua:
exports.object_gizmo:useGizmo(entity, { camera = 'gameplay' })
exports.object_gizmo:useGizmo(entity, { camera = 'orbit' })Controls
Players can rebind these under Settings, Key Bindings, FiveM.
| Key | Action |
|---|---|
| W | Translate |
| R | Rotate |
| S | Scale, when scale is enabled for that call |
| Q | World / local |
| Left Alt | Snap to ground |
| G | Release the cursor so the gameplay camera can look |
| X | Toggle snap |
| C | Copy the transform |
| Enter | Finish |
| Esc | Cancel and restore |
G is not used while the camera mode is orbit. Drag empty space to orbit, and scroll to zoom.
Enter from the chat command that opened the gizmo is ignored. Press Enter again after the gizmo is open to finish.
Test Command
/testGizmo is registered only when Config.debug is true. Leave that off on a live server. The command spawns a prop, or a ped, in front of the player.
/testGizmo
/testGizmo prop_bench_01a
/testGizmo ped
/testGizmo ped a_f_y_business_01
/testGizmo orbit
/testGizmo orbit ped
/testGizmo gameplay prop_barrier_work05Locales
Set the language with the ox:locale convar, for example setr ox:locale "de".
Available: cs, de, en, es, fr, it, nl, pl, pt-br, ru, sv, tr.
Support
If you need help or have questions:
