This module exports a useGizmo function that enables manipulation of entity position and rotation.
- Download the
object_gizmoresource. - Extract the
object_gizmofolder into your server'sresourcesdirectory. - Add
start object_gizmoto your server'sserver.cfgfile.
exports.object_gizmo:useGizmo(handle)
Ensure the object_gizmo module script is running on your server.
The useGizmo export can be used in any Lua script on the client side as follows:
local handle = --[[Your target entity]]
local result = exports.object_gizmo:useGizmo(handle)result will contain the entity handle, final position, and final rotation.
This module includes a test command testGizmo that demonstrates how to use the gizmo.
It is only registered when Config.debug is true, and logs a warning when it is.
The command creates an object at the player's location and then activates the gizmo for that object.
local model = `prop_mp_cone_02`
RegisterCommand('testGizmo', function()
local offset = GetEntityCoords(cache.ped) + GetEntityForwardVector(cache.ped) * 3
lib.requestModel(model)
local obj = CreateObject(model, offset.x, offset.y, offset.z, false, false, false)
local data = exports.object_gizmo:useGizmo(obj)
lib.print.info(data)
end)Set the language with the ox:locale convar in your server.cfg, e.g. setr ox:locale "de".
Available: cs, de, en, es, fr, it, nl, pl, pt-br, ru, sv, tr.
To add one, copy locales/en.json to locales/<code>.json and translate the values. The manifest
globs locales/*.json, so no other change is needed.
The config.lua file at the root of the resource lets you change how the gizmo looks:
Config.outlineColor = { r = 255, g = 255, b = 255, a = 255 } -- highlight colour (RGBA, 0-255)
Config.outlineShader = 0 -- 0 = hard edge, 1 = softer/filled edge
Config.pedAlpha = 200 -- peds can't be outlined, they fade instead (0-255)
Config.enableScale = false -- enable Scale Mode ([S])
Config.debug = false -- enable the /testGizmo debug commandWhile using the gizmo, the following controls apply:
- [W]: Switch to Translate Mode
- [R]: Switch to Rotate Mode
- [S]: Switch to Scale Mode (if enabled)
- [Q]: Switch between Relative and World
- [LAlt]: Snap To Ground
- [Enter]: Finish Editing
The current mode (Translate/Rotate) will be displayed on the screen.
The gizmo only works on entities that you have sufficient permissions to manipulate. Make sure you have the correct permissions to move or rotate the entity you are working with.
- Andyyy7666
- AvarianKnight
- citizenfx —
client/dataview.lua