From the reference libraryRedM

autodoc_client_functions

jo_libs/modules/gizmo/autodoc/autodoc_client_functions.md

autodoc_client_functions

JO Functions > jo.gizmo.cancel()

Cancels the currently active gizmo interface <br>

JO Functions > jo.gizmo.cancel() > Syntax

jo.gizmo.cancel()

JO Functions > jo.gizmo.cancel() > Example

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 Functions > jo.gizmo.moveEntity()

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

JO Functions > jo.gizmo.moveEntity() > Syntax

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

JO Functions > jo.gizmo.moveEntity() > Parameters

entity : integer

The entity to move

cfg : table <BadgeOptional />

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

cfg.allowTranslateX : boolean - Allow translation on X-axis - default true

cfg.allowTranslateY : boolean - Allow translation on Y-axis - default true

cfg.allowTranslateZ : boolean - Allow translation on Z-axis - default true

cfg.allowRotateX : boolean - Allow rotation on X-axis - default true

cfg.allowRotateY : boolean - Allow rotation on Y-axis - default true

cfg.allowRotateZ : boolean - Allow rotation on Z-axis - default true

cfg.allowSnapToGround : boolean - Allow snapping to ground - default true

cfg.rotationSnap : number - Rotation snap value - default 5

cfg.onMove : function - Optional function fired when the entity move with the gizmo

allowPlace : function <BadgeOptional />

Optional callback to validate placement - receives proposed position as parameter

JO Functions > jo.gizmo.moveEntity() > Return Value

Type : table|nil

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

JO Functions > jo.gizmo.moveEntity() > Example

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)

JO Functions > jo.gizmo.moveEntity() > Parameters

entity : integer

The entity to move

cfg : table <BadgeOptional />

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

cfg.allowTranslateX : boolean - Allow translation on X-axis - default true

cfg.allowTranslateY : boolean - Allow translation on Y-axis - default true

cfg.allowTranslateZ : boolean - Allow translation on Z-axis - default true

cfg.allowRotateX : boolean - Allow rotation on X-axis - default true

cfg.allowRotateY : boolean - Allow rotation on Y-axis - default true

cfg.allowRotateZ : boolean - Allow rotation on Z-axis - default true

cfg.allowSnapToGround : boolean - Allow snapping to ground - default true

cfg.rotationSnap : number - Rotation snap value - default 5

cfg.onMove : function - Optional function fired when the entity move with the gizmo

cfg.onlyOnMove : boolean - Optional if onMove set the position or rotation will only be send to the function

allowPlace : function <BadgeOptional />

Optional callback to validate placement - receives proposed position as parameter

Back to documentation