Gizmo <BadgeClient/>
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)
| Convar | Side | Type | Default | Description |
|---|---|---|---|---|
jo_libs:gizmo:allowRotateX |
<Badge type="client" text="Client" /> | Boolean | true |
Allow rotation on X-axis |
jo_libs:gizmo:allowRotateY |
<Badge type="client" text="Client" /> | Boolean | true |
Allow rotation on Y-axis |
jo_libs:gizmo:allowRotateZ |
<Badge type="client" text="Client" /> | Boolean | true |
Allow rotation on Z-axis |
jo_libs:gizmo:allowSnapToGround |
<Badge type="client" text="Client" /> | Boolean | true |
Allow snapping to ground |
jo_libs:gizmo:allowTranslateX |
<Badge type="client" text="Client" /> | Boolean | true |
Allow translation on X-axis |
jo_libs:gizmo:allowTranslateY |
<Badge type="client" text="Client" /> | Boolean | true |
Allow translation on Y-axis |
jo_libs:gizmo:allowTranslateZ |
<Badge type="client" text="Client" /> | Boolean | true |
Allow translation on Z-axis |
jo_libs:gizmo:enableCam |
<Badge type="client" text="Client" /> | Boolean | true |
Enable/Disable camera feature |
jo_libs:gizmo:keys:cameraSpeedDown |
<Badge type="client" text="Client" /> | Integer | INPUT_SELECT_NEXT_WEAPON |
Decrease camera speed |
jo_libs:gizmo:keys:cameraSpeedUp |
<Badge type="client" text="Client" /> | Integer | INPUT_SELECT_PREV_WEAPON |
Increase camera speed |
jo_libs:gizmo:keys:cancel |
<Badge type="client" text="Client" /> | Integer | INPUT_GAME_MENU_TAB_RIGHT_SECONDARY |
Cancel operation |
jo_libs:gizmo:keys:confirm |
<Badge type="client" text="Client" /> | Integer | INPUT_FRONTEND_ACCEPT |
Confirm placement |
jo_libs:gizmo:keys:focusEntity |
<Badge type="client" text="Client" /> | Integer | INPUT_SHOP_SPECIAL |
Toggle focus on entity |
jo_libs:gizmo:keys:moveDown |
<Badge type="client" text="Client" /> | Integer | INPUT_FRONTEND_RUP |
Move down |
jo_libs:gizmo:keys:moveUp |
<Badge type="client" text="Client" /> | Integer | INPUT_FRONTEND_X |
Move up |
jo_libs:gizmo:keys:moveX |
<Badge type="client" text="Client" /> | Integer | INPUT_SCRIPTED_FLY_LR |
Move left/right |
jo_libs:gizmo:keys:moveY |
<Badge type="client" text="Client" /> | Integer | INPUT_SCRIPTED_FLY_UD |
Move forward/backward |
jo_libs:gizmo:keys:rotationSnap |
<Badge type="client" text="Client" /> | Integer | INPUT_FRONTEND_Y |
Rotation snap key |
jo_libs:gizmo:keys:snapToGround |
<Badge type="client" text="Client" /> | Integer | INPUT_INTERACT_OPTION1 |
Snap entity to ground |
jo_libs:gizmo:keys:switchMode |
<Badge type="client" text="Client" /> | Integer | INPUT_RELOAD |
Switch between translate/rotate modes |
jo_libs:gizmo:maxCamDistance |
<Badge type="client" text="Client" /> | Integer | 80 |
Maximum distance camera can be moved from player |
jo_libs:gizmo:maxDistance |
<Badge type="client" text="Client" /> | Integer | 100 |
Maximum distance entity can be moved from starting position (set to false to disable) |
jo_libs:gizmo:maxMovementSpeed |
<Badge type="client" text="Client" /> | Float | 0.2 |
Maximum movement speed for camera |
jo_libs:gizmo:maxY |
<Badge type="client" text="Client" /> | Integer | 40 |
Maximum Y value for camera rotation |
jo_libs:gizmo:minMovementSpeed |
<Badge type="client" text="Client" /> | Float | 0.001 |
Minimum movement speed for camera |
jo_libs:gizmo:minY |
<Badge type="client" text="Client" /> | Integer | -40 |
Minimum Y value for camera rotation |
jo_libs:gizmo:movementSpeed |
<Badge type="client" text="Client" /> | Float | 0.1 |
Default movement speed for camera |
jo_libs:gizmo:movementSpeedIncrement |
<Badge type="client" text="Client" /> | Float | 0.01 |
Increment value when adjusting camera speed |
jo_libs:gizmo:rotationSnap |
<Badge type="client" text="Client" /> | Integer | 5 |
Rotation snap value |
Configuration Variables (Convars) > Runtime Configuration
You can also override specific configuration options when calling jo.gizmo.moveEntity() by passing a configuration table as the second parameter:
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()
<!-- @include: ./slots/headers.md#client|jo.gizmo.cancel -->
Cancels the currently active gizmo interface <br>
<!-- @include: ./slots/descriptions.md#client|jo.gizmo.cancel -->
JO Functions > jo.gizmo.cancel() > Syntax
jo.gizmo.cancel()
<!-- @include: ./slots/examples.md#client|jo.gizmo.cancel -->
<!-- @include: ./slots/footers.md#client|jo.gizmo.cancel -->
JO Functions > jo.gizmo.moveEntity()
<!-- @include: ./slots/headers.md#client|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>
<!-- @include: ./slots/descriptions.md#client|jo.gizmo.moveEntity -->
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 - defaulttrue
cfg.allowTranslateY: boolean - Allow translation on Y-axis - defaulttrue
cfg.allowTranslateZ: boolean - Allow translation on Z-axis - defaulttrue
cfg.allowRotateX: boolean - Allow rotation on X-axis - defaulttrue
cfg.allowRotateY: boolean - Allow rotation on Y-axis - defaulttrue
cfg.allowRotateZ: boolean - Allow rotation on Z-axis - defaulttrue
cfg.allowSnapToGround: boolean - Allow snapping to ground - defaulttrue
cfg.rotationSnap: number - Rotation snap value - default5
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
<!-- @include: ./slots/examples.md#client|jo.gizmo.moveEntity -->
<!-- @include: ./slots/footers.md#client|jo.gizmo.moveEntity -->
Configuration Variables (Convars)
| Convar | Side | Type | Default | Description |
|---|---|---|---|---|
jo_libs:gizmo:allowRotateX |
<Badge type="client" text="Client" /> | Boolean | true |
Allow rotation on X-axis |
jo_libs:gizmo:allowRotateY |
<Badge type="client" text="Client" /> | Boolean | true |
Allow rotation on Y-axis |
jo_libs:gizmo:allowRotateZ |
<Badge type="client" text="Client" /> | Boolean | true |
Allow rotation on Z-axis |
jo_libs:gizmo:allowSnapToGround |
<Badge type="client" text="Client" /> | Boolean | true |
Allow snapping to ground |
jo_libs:gizmo:allowTranslateX |
<Badge type="client" text="Client" /> | Boolean | true |
Allow translation on X-axis |
jo_libs:gizmo:allowTranslateY |
<Badge type="client" text="Client" /> | Boolean | true |
Allow translation on Y-axis |
jo_libs:gizmo:allowTranslateZ |
<Badge type="client" text="Client" /> | Boolean | true |
Allow translation on Z-axis |
jo_libs:gizmo:enableCam |
<Badge type="client" text="Client" /> | Boolean | true |
Enable/Disable camera feature |
jo_libs:gizmo:keys:cameraSpeedDown |
<Badge type="client" text="Client" /> | Integer | INPUT_SELECT_NEXT_WEAPON |
Decrease camera speed |
jo_libs:gizmo:keys:cameraSpeedUp |
<Badge type="client" text="Client" /> | Integer | INPUT_SELECT_PREV_WEAPON |
Increase camera speed |
jo_libs:gizmo:keys:cancel |
<Badge type="client" text="Client" /> | Integer | INPUT_GAME_MENU_TAB_RIGHT_SECONDARY |
Cancel operation |
jo_libs:gizmo:keys:confirm |
<Badge type="client" text="Client" /> | Integer | INPUT_FRONTEND_ACCEPT |
Confirm placement |
jo_libs:gizmo:keys:focusEntity |
<Badge type="client" text="Client" /> | Integer | INPUT_SHOP_SPECIAL |
Toggle focus on entity |
jo_libs:gizmo:keys:moveDown |
<Badge type="client" text="Client" /> | Integer | INPUT_FRONTEND_RUP |
Move down |
jo_libs:gizmo:keys:moveUp |
<Badge type="client" text="Client" /> | Integer | INPUT_FRONTEND_X |
Move up |
jo_libs:gizmo:keys:moveX |
<Badge type="client" text="Client" /> | Integer | INPUT_SCRIPTED_FLY_LR |
Move left/right |
jo_libs:gizmo:keys:moveY |
<Badge type="client" text="Client" /> | Integer | INPUT_SCRIPTED_FLY_UD |
Move forward/backward |
jo_libs:gizmo:keys:rotationSnap |
<Badge type="client" text="Client" /> | Integer | INPUT_FRONTEND_Y |
Rotation snap key |
jo_libs:gizmo:keys:snapToGround |
<Badge type="client" text="Client" /> | Integer | INPUT_INTERACT_OPTION1 |
Snap entity to ground |
jo_libs:gizmo:keys:switchMode |
<Badge type="client" text="Client" /> | Integer | INPUT_RELOAD |
Switch between translate/rotate modes |
jo_libs:gizmo:maxCamDistance |
<Badge type="client" text="Client" /> | Integer | 80 |
Maximum distance camera can be moved from player |
jo_libs:gizmo:maxDistance |
<Badge type="client" text="Client" /> | Integer | 100 |
Maximum distance entity can be moved from starting position (set to false to disable) |
jo_libs:gizmo:maxMovementSpeed |
<Badge type="client" text="Client" /> | Float | 0.2 |
Maximum movement speed for camera |
jo_libs:gizmo:maxY |
<Badge type="client" text="Client" /> | Integer | 40 |
Maximum Y value for camera rotation |
jo_libs:gizmo:minMovementSpeed |
<Badge type="client" text="Client" /> | Float | 0.001 |
Minimum movement speed for camera |
jo_libs:gizmo:minY |
<Badge type="client" text="Client" /> | Integer | -40 |
Minimum Y value for camera rotation |
jo_libs:gizmo:movementSpeed |
<Badge type="client" text="Client" /> | Float | 0.1 |
Default movement speed for camera |
jo_libs:gizmo:movementSpeedIncrement |
<Badge type="client" text="Client" /> | Float | 0.01 |
Increment value when adjusting camera speed |
jo_libs:gizmo:onlyOnMove |
<Badge type="client" text="Client" /> | Boolean | false |
|
jo_libs:gizmo:rotationSnap |
<Badge type="client" text="Client" /> | Integer | 5 |
Rotation snap value |
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 - defaulttrue
cfg.allowTranslateY: boolean - Allow translation on Y-axis - defaulttrue
cfg.allowTranslateZ: boolean - Allow translation on Z-axis - defaulttrue
cfg.allowRotateX: boolean - Allow rotation on X-axis - defaulttrue
cfg.allowRotateY: boolean - Allow rotation on Y-axis - defaulttrue
cfg.allowRotateZ: boolean - Allow rotation on Z-axis - defaulttrue
cfg.allowSnapToGround: boolean - Allow snapping to ground - defaulttrue
cfg.rotationSnap: number - Rotation snap value - default5
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