Skip to content

Gizmo Client

Gizmo module is a specialized tool for manipulating entities in 3D space within RedM. It provides a visual interface for moving, rotating, and precisely positioning objects with optional camera controls.

Configuration Variables (Convars)

ConvarSideTypeDefaultDescription
jo_libs:gizmo:enableCamClientBooleantrueEnable/Disable camera feature
jo_libs:gizmo:keys:cameraSpeedDownClientIntegerINPUT_SELECT_NEXT_WEAPONDecrease camera speed
jo_libs:gizmo:keys:cameraSpeedUpClientIntegerINPUT_SELECT_PREV_WEAPONIncrease camera speed
jo_libs:gizmo:keys:cancelClientIntegerINPUT_GAME_MENU_TAB_RIGHT_SECONDARYCancel operation
jo_libs:gizmo:keys:confirmClientIntegerINPUT_FRONTEND_ACCEPTConfirm placement
jo_libs:gizmo:keys:focusEntityClientIntegerINPUT_SHOP_SPECIALToggle focus on entity
jo_libs:gizmo:keys:moveDownClientIntegerINPUT_FRONTEND_RUPMove down
jo_libs:gizmo:keys:moveUpClientIntegerINPUT_FRONTEND_XMove up
jo_libs:gizmo:keys:moveXClientIntegerINPUT_SCRIPTED_FLY_LRMove left/right
jo_libs:gizmo:keys:moveYClientIntegerINPUT_SCRIPTED_FLY_UDMove forward/backward
jo_libs:gizmo:keys:snapToGroundClientIntegerINPUT_INTERACT_OPTION1Snap entity to ground
jo_libs:gizmo:keys:switchModeClientIntegerINPUT_RELOADSwitch between translate/rotate modes
jo_libs:gizmo:maxCamDistanceClientInteger80Maximum distance camera can be moved from player
jo_libs:gizmo:maxDistanceClientInteger100Maximum distance entity can be moved from starting position (set to false to disable)
jo_libs:gizmo:maxMovementSpeedClientFloat0.2Maximum movement speed for camera
jo_libs:gizmo:maxYClientInteger40Maximum Y value for camera rotation
jo_libs:gizmo:minMovementSpeedClientFloat0.001Minimum movement speed for camera
jo_libs:gizmo:minYClientInteger-40Minimum Y value for camera rotation
jo_libs:gizmo:movementSpeedClientFloat0.1Default movement speed for camera
jo_libs:gizmo:movementSpeedIncrementClientFloat0.01Increment value when adjusting camera speed

Runtime Configuration

You can also override specific configuration options when calling jo.gizmo.moveEntity() by passing a configuration table as the second parameter:

lua
local result = jo.gizmo.moveEntity(object, {
    enableCam = false,           -- Disable camera for this specific call
    maxDistance = 200,           -- Allow movement up to 200 units away
    movementSpeed = 0.2          -- Set faster movement speed for this instance
})

This allows for flexible configuration on a per-call basis without changing the server-wide defaults.

JO Functions

jo.gizmo.cancel()

Cancels the currently active gizmo interface

Syntax

lua
jo.gizmo.cancel()

Example

lua
CreateThread(function()
  local entity = 1234566
  local cfg = {
    enableCam = true,
    maxDistance = 5.0,
    maxCamDistance = 10.0,
    minY = -20.0,
    maxY = 20.0,
    movementSpeed = 0.1
  }
  local function allowPlace(position)
    log("Position:", position)
    return true
  end
  local result = jo.gizmo.moveEntity(entity, cfg, allowPlace)
end)

--Cancel the gizmo after 10s
CreateThread(function()
  Wait(10000)
  jo.gizmo.cancel()
end)

jo.gizmo.moveEntity()

Setup a gizmo interface to move an entity in 3D space
Allows for precise positioning and rotation of entities through a visual interface
Uses a camera system for better manipulation when enabled

Syntax

lua
jo.gizmo.moveEntity(entity, cfg, allowPlace)

Parameters

entity : integer

The entity to move

cfg : table Optional

Configuration options to override defaults

cfg.enableCam : boolean - Enable/disable camera feature - default based on config

cfg.maxDistance : number - Max distance the entity can be moved from starting position - default based on config

cfg.maxCamDistance : number - Max distance the camera can be moved from player - default based on config

cfg.minY : number - Min Y value from starting position for camera - default based on config

cfg.maxY : number - Max Y value from starting position for camera - default based on config

cfg.movementSpeed : number - Movement speed for camera - default based on config

allowPlace : function Optional

Optional callback to validate placement - receives proposed position as parameter

Return Value

Type : table|nil

Returns entity position and rotation data when completed, nil if already active

Example

lua
local entity = 1234566
local cfg = {
  enableCam = true,
  maxDistance = 5.0,
  maxCamDistance = 10.0,
  minY = -20.0,
  maxY = 20.0,
  movementSpeed = 0.1
}
local function allowPlace(position)
  log("Position:", position)
  return true
end
local result = jo.gizmo.moveEntity(entity, cfg, allowPlace)
log(result)

Last updated: