🧭 Gizmo
Un outil pour transformer des objets pendant l'exécution

Client OnlyAPI Source
👪Inheritance
This class shares methods and events from Base Entity, Base Actor.
🎒 Exemples
-- Disable input and enable mouse cursor
Input.SetInputEnabled(false)
Input.SetMouseEnabled(true)
-- Spawn a mesh to interact with
local my_entity = StaticMesh(Vector(0, 0, 100), Rotator(), "nanos-world::SM_Cube")
-- Spawn the gizmo
local my_gizmo = Gizmo()
-- Activate the gizmo, at the location of the mesh
my_gizmo:Activate(my_entity:GetLocation(), my_entity:GetRotation(), my_entity:GetScale())
-- Subscribes on Gizmo updates
my_gizmo:Subscribe("Transform", function(self, location, rotation, scale)
my_entity:TranslateTo(location, 0.02)
my_entity:RotateTo(rotation, 0.02)
my_entity:SetScale(scale)
end)
-- When Mouse click, trigger Gizmo inputs
Input.Subscribe("MouseDown", function(key)
if (key == "LeftMouseButton") then
my_gizmo:PressPointer()
end
end)
-- When Mouse release, trigger Gizmo inputs
Input.Subscribe("MouseUp", function (key, b, c)
if (key == "LeftMouseButton") then
my_gizmo:ReleasePointer()
end
end)
🛠 Constructeurs
Default Constructor
No description provided
local my_gizmo = Gizmo()
This constructor doesn't have parameters.
🗿 Static Functions
This class doesn't have own static functions.
Inherited static functions
From Entity11 functions
Events
Subscribe, UnsubscribeNetwork
SubscribeRemoteQueries
GetAll, GetByIndex, GetCount, GetPairs🦠 Fonctions
Activate | Enables the interaction, placing the Gizmo at the given transform | |
Deactivate | Disable the interaction | |
IsInteracting: boolean | Returns if it's currently interacting | |
PressPointer | Triggers the press pointer event on it | |
ReleasePointer | Triggers the release pointer event on it | |
SetAlignSpace | Sets whether the Gizmo is aligned to the local or the world space | |
SetSnapSettings | Sets the snapping grid sizes, 0 to disable snapping | |
SetTransformMode | Sets whether the Gizmo translates, rotates or scales |
Inherited functions
From Actor60 functions
Appearance
GetDistanceFromCamera, GetScreenPercentage, IsVisible, SetCastShadow, SetHighlightEnabled, SetOutlineEnabled, SetRenderCullDistance, SetVisibility, WasRecentlyRenderedAttachments
AttachTo, Detach, GetAttachedEntities, GetAttachedTo, GetAttachedToSocket, GetSocketTransformLifecycle
GetLifeSpan, SetLifeSpanNetwork
GetDimension, GetNetworkAuthority, HasNetworkAuthority, IsNetworkDistributed, SetDimension, SetDistanceOptimizationMultiplier, SetNetworkAuthority, SetNetworkAuthorityAutoDistributedFrom Entity21 functions
Data
GetAllValuesKeys, GetValue, SetValueEvents
Subscribe, UnsubscribeLifecycle
Destroy, FinishSpawn, IsBeingDestroyed, IsSpawned, IsValid, SetSpawnModeNetwork
BroadcastRemoteEvent, BroadcastRemoteInRadiusEvent, CallRemoteEvent, CallRemoteEvent, CallRemotePlayersEvent, HasAuthority, SubscribeRemoteQueries
GetID
ActivateModerate
Enables the interaction, placing the Gizmo at the given transform
my_gizmo:Activate(location, rotation, scale)

IsInteractingModerate
Returns if it's currently interacting
local is_interacting = my_gizmo:IsInteracting()
Returns
| Type | Description |
|---|---|
| boolean | Whether it's currently interacting |

SetAlignSpaceModerate
Sets whether the Gizmo is aligned to the local or the world space
my_gizmo:SetAlignSpace(align_space)
Paramètres
| Name | Type | Description |
|---|---|---|
align_space | GizmoAlignSpace | The align space |

SetSnapSettingsModerate
Sets the snapping grid sizes, 0 to disable snapping
my_gizmo:SetSnapSettings(location_grid_size, rotation_grid_size, scale_grid_size)

SetTransformModeModerate
Sets whether the Gizmo translates, rotates or scales
my_gizmo:SetTransformMode(transform_mode, combine_translate_rotate)
Paramètres
| Name | Type | Description |
|---|---|---|
transform_mode | GizmoTransformMode | The transform mode |
combine_translate_rotate | boolean | Whether to show the translation and rotation handles together |
🚀 Events
Transform | Déclenché quand la transformation du Gizmo est mise à jour |
Inherited events
From Actor5 events
From Entity4 events
All events
ClassRegister, Destroy, Spawn, ValueChange
Transform
Déclenché quand la transformation du Gizmo est mise à jour
Gizmo.Subscribe("Transform", function(self, location, rotation, scale)
-- Transform was called
end)
