💡 Light
Une Light représente une source de lumière.

🎒 Exemples
local my_light = Light(
Vector(-152, 245, 115),
Rotator(0, 90, 90), -- Relevant only for Rect and Spot light types
Color(1, 0, 0), -- Red Tint
LightType.Point, -- Point Light type
100, -- Intensity
250, -- Attenuation Radius
44, -- Cone Angle (Relevant only for Spot light type)
0, -- Inner Cone Angle Percent (Relevant only for Spot light type)
5000, -- Max Draw Distance (Good for performance - 0 for infinite)
true, -- Whether to use physically based inverse squared distance falloff, where Attenuation Radius is only clamping the light's contribution. (Spot and Point types only)
true, -- Cast Shadows?
true -- Enabled?
)
🛠 Constructors
Default Constructor
No description provided
local my_light = Light(location, rotation?, color?, light_type?, intensity?, attenuation_radius?, cone_angle?, inner_cone_angle_percent?, max_draw_distance?, use_inverse_squared_falloff?, cast_shadows?, visible?, source_radius?, spawn_mode?)
Parameters
| Type | Name | Default | Description |
|---|---|---|---|
| Vector | location | Required parameter | World location to spawn at |
| Rotator | rotation | Rotator(0, 0, 0) | Pertinent uniquement pour les LightType Rect et Spot |
| Color | color | Color(1, 1, 1) | Color of the light |
| LightType | light_type | LightType.Point | Point, Spot or Rect |
| float | intensity | 30 | Brightness of the light |
| float | attenuation_radius | 250 | Distance the light reaches |
| float | cone_angle | 44 | Pertinent uniquement pour le LightType Spot |
| float | inner_cone_angle_percent | 0 | Pourcentage de l'angle du cône interne (pertinent uniquement pour le LightType Spot) (0-1) |
| float | max_draw_distance | 10000 | Distance d'affichage maximale (bon pour les performances) — 0 pour infini |
| boolean | use_inverse_squared_falloff | true | Whether to use physically based inverse squared distance falloff, where Attenuation Radius is only clamping the light's contribution. (Spot and Point types only) |
| boolean | cast_shadows | true | Whether the light casts shadows |
| boolean | visible | true | Whether the light starts visible |
| float | source_radius | 2 | Radius of light source shape. (Spot and Point types only) |
| SpawnMode | spawn_mode | SpawnMode.Immediate | Pass SpawnMode.AfterConstructor or SpawnMode.Manual to avoid immediately sending the entity to clients and improve performance when you want to configure it by setting several configs. Must call FinishSpawn() after all |
nanos world provides 3 types of lights: Spot, Point and Rect. Toutes les entités Light sont dynamiques, et donc très coûteuses! Gardez cela à l'esprit avant de faire apparaître 1000 lumières 😉.
🗿 Fonctions statiques
Inherited Entity Static Functions
Base Entityscripting-reference/classes/base-classes/entity
| Returns | Name | Description | |
|---|---|---|---|
| table of Base Entity | GetAll | Returns a table containing all Entities of the class this is called on | |
| Base Entity | GetByIndex | Returns a specific Entity of this class at an index | |
| integer | GetCount | Returns how many Entities of this class exist | |
| table of table | GetInheritedClasses | Gets a list of all directly inherited classes from this Class created with the Inheriting System | |
| iterator | GetPairs | Returns an iterator with all Entities of this class to be used with pairs() | |
| table or nil | GetParentClass | Gets the parent class if this Class was created with the Inheriting System | |
| table | Inherit | Inherits this class with the Inheriting System | |
| boolean | IsChildOf | Gets if this Class is child of another class if this Class was created with the Inheriting System | |
| function | Subscribe | Subscribes to an Event for all entities of this Class | |
| function | SubscribeRemote | Subscribes to a custom event called from server | |
Unsubscribe | Unsubscribes all callbacks from this Event in this Class within this Package, or only the callback passed |
This class doesn't have own static functions.
🦠 Fonctions
Inherited Entity Functions
Base Entityscripting-reference/classes/base-classes/entity
| Returns | Name | Description | |
|---|---|---|---|
BroadcastRemoteEvent | Calls a custom remote event directly on this entity to all Players | ||
BroadcastRemoteInRadiusEvent | Appelle un événement distant personnalisé directement sur cette entité pour tous les Joueurs dans un rayon donné | ||
CallRemoteEvent | Calls a custom remote event directly on this entity to a specific Player | ||
CallRemoteEvent | Calls a custom remote event directly on this entity | ||
CallRemotePlayersEvent | Appelle un événement distant personnalisé directement sur cette entité pour une liste de Joueurs | ||
Destroy | Destroys this Entity | ||
FinishSpawn | Finish the spawning process and send the entity to clients if it was spawned with a deferred spawn_mode | ||
| table of string | GetAllValuesKeys | Gets a list of all values keys | |
| table | GetClass | Gets the class of this entity | |
| integer | GetID | Gets the universal network ID of this Entity (same on both client and server) | |
| any | GetValue | Gets a Value stored on this Entity at the given key | |
| boolean | HasAuthority | Gets if the local context has authority over this Entity (true if spawned by the client, false if spawned by the server) | |
| boolean | IsA | Recursively checks if this entity is inherited from a Class | |
| boolean | IsBeingDestroyed | Returns true if this Entity is being destroyed | |
| boolean | IsSpawned | Gets if this Entity finished spawning | |
| boolean | IsValid | Returns true if this Entity is valid (i.e. wasn't destroyed and points to a valid Entity) | |
SetSpawnMode | Overrides when this Entity finishes spawning, from the Constructor of an Inherited Class | ||
SetValue | Sets a Value in this Entity | ||
| function | Subscribe | Subscribes to an Event on this specific entity | |
| function | SubscribeRemote | Subscribes to a custom event called from server on this specific entity | |
Unsubscribe | Unsubscribes all callbacks from this Event in this Entity within this Package, or only the callback passed |
Inherited Actor Functions
Base Actorscripting-reference/classes/base-classes/actor
| Returns | Name | Description | |
|---|---|---|---|
AddActorTag | Adds an Unreal Actor Tag to this Actor | ||
AddAngularImpulse | Add an angular impulse to this Actor. Good for one time instant burst | ||
AddImpulse | Add an impulse to this Actor. Good for one time instant burst | ||
| boolean | AttachTo | Attache cet acteur à tout autre acteur, éventuellement à un os spécifique | |
Detach | Détache cet Acteur à partir de AttachedTo Actor | ||
| table of string | GetActorTags | Gets all Unreal Actor Tags on this Actor | |
| Vector | GetAngularForce | Gets this Actor's angular force (set by SetAngularForce()) | |
| float | GetAngularVelocity | Renvoie la vitesse angulaire de cet Acteur | |
| table of Base Actor | GetAttachedEntities | Gets all Actors attached to this Actor | |
| Base Actor or nil | GetAttachedTo | Gets the Actor this Actor is attached to | |
| string | GetAttachedToSocket | Gets the bone or socket name this Actor is attached to | |
| table | GetBounds | Gets this Actor's bounds, useful to know its size in the world | |
| CollisionType | GetCollision | Gets this Actor's collision type | |
| integer | GetDimension | Gets this Actor's dimension | |
| float | GetDistanceFromCamera | Gets the distance of this Actor from the Camera | |
| Vector | GetForce | Gets this Actor's force (set by SetForce()) | |
| float | GetLifeSpan | Gets the time (in seconds) left before this Actor is destroyed | |
| Vector | GetLocation | Gets this Actor's location in the game world | |
| float | GetMass | Renvoie la masse de cet Acteur | |
| Player or nil | GetNetworkAuthority | Gets this Actor's Network Authority Player | |
| Vector | GetRelativeLocation | Gets this Actor's Relative Location if it's attached | |
| Rotator | GetRelativeRotation | Gets this Actor's Relative Rotation if it's attached | |
| Rotator | GetRotation | Gets this Actor's angle in the game world | |
| Vector | GetScale | Gets this Actor's scale | |
| float | GetScreenPercentage | Gets the percentage of this Actor size in the screen | |
| table | GetSocketTransform | Gets a Socket Transform in world space given a bone or socket name | |
| Vector | GetVelocity | Gets this Actor's current velocity | |
| boolean | HasNetworkAuthority | Returns true if the local Player is currently the Network Authority of this Actor | |
| boolean | IsGravityEnabled | Returns true if gravity is enabled on this Actor | |
| boolean | IsImpulseOnDamage | Returns true if taking damage pushes this Actor's physics body | |
| boolean | IsInWater | Returns true if this Actor is in water | |
| boolean | IsNetworkDistributed | Returns true if this Actor is currently network distributed | |
| boolean | IsVisible | Returns true if this Actor is visible | |
RemoveActorTag | Removes an Unreal Actor Tag from this Actor | ||
RotateRelativeTo | Smoothly rotates this attached actor to an angle relative to its parent over a certain time | ||
RotateTo | Smoothly rotates this actor to an angle over a certain time | ||
SetAngularForce | Adds a permanent angular force to this Actor, set to Vector(0, 0, 0) to cancel | ||
SetCastShadow | Sets this Actor's to cast shadows or not | ||
SetCollision | Sets this Actor's collision type | ||
SetDimension | Sets this Actor's Dimension. Actors only see and interact with entities in the same Dimension | ||
SetDistanceOptimizationMultiplier | Définit le multiplicateur d'optimisation de distance de cet Acteur | ||
SetForce | Adds a permanent force to this Actor, set to Vector(0, 0, 0) to cancel | ||
SetGravityEnabled | Sets whether gravity is enabled on this Actor | ||
SetHighlightEnabled | Sets whether the highlight is enabled on this Actor, and which highlight index to use | ||
SetImpulseOnDamage | Sets whether taking damage (shots, melee, explosions) pushes this Actor's physics body | ||
SetLifeSpan | Sets the time (in seconds) before this Actor is destroyed. After this time has passed, the actor will be automatically destroyed. | ||
SetLocation | Sets this Actor's location in the game world | ||
SetNetworkAuthority | Sets the Player to have network authority over this Actor | ||
SetNetworkAuthorityAutoDistributed | Sets if this Actor will auto distribute the network authority between players | ||
SetOutlineEnabled | Définit si le contour est activé sur cet acteur et quel index de contour utiliser | ||
SetRelativeLocation | Sets this Actor's relative location in local space (only if this actor is attached) | ||
SetRelativeRotation | Sets this Actor's relative rotation in local space (only if this actor is attached) | ||
SetRenderCullDistance | Sets this Actor's render cull distance | ||
SetRotation | Sets this Actor's rotation in the game world | ||
SetScale | Sets this Actor's scale | ||
SetVisibility | Sets whether the actor is visible or not | ||
TranslateRelativeTo | Smoothly moves this attached actor to a location relative to its parent over a certain time | ||
TranslateTo | Smoothly moves this actor to a location over a certain time | ||
| boolean | WasRecentlyRendered | Gets if this Actor was recently rendered on screen |
| Returns | Name | Description | |
|---|---|---|---|
| float | GetAttenuationRadius | Gets the distance this Light reaches | |
| boolean | GetCastShadows | Gets if this Light casts shadows | |
| Color | GetColor | Gets the color of this Light | |
| float | GetIntensity | Gets the brightness of this Light | |
SetAttenuationRadius | Sets the distance this Light reaches | ||
SetCastShadows | Sets if this Light casts shadows | ||
SetColor | Définir la couleur de la lumière | ||
SetIntensity | Sets the brightness of this Light | ||
SetTextureLightProfile | Définit le profil de texture de la lumière |
Optimal

GetAttenuationRadius
Gets the distance this Light reaches
local attenuation_radius = my_light:GetAttenuationRadius()
Returns
| Type | Description |
|---|---|
| float | The attenuation radius |
See also SetAttenuationRadius.
Optimal

GetCastShadows
Gets if this Light casts shadows
local is_shadows_enabled = my_light:GetCastShadows()
Returns
| Type | Description |
|---|---|
| boolean | Whether it casts shadows |
See also SetCastShadows.
Optimal

GetColor
Gets the color of this Light
local color = my_light:GetColor()
Returns
| Type | Description |
|---|---|
| Color | La couleur de la lumière |
See also SetColor.
Optimal

GetIntensity
Gets the brightness of this Light
local intensity = my_light:GetIntensity()
Returns
| Type | Description |
|---|---|
| float | The brightness |
See also SetIntensity.
Optimal

SetAttenuationRadius
Sets the distance this Light reaches
my_light:SetAttenuationRadius(attenuation_radius)
Parameters
| Type | Parameter | Default | Description |
|---|---|---|---|
| float | attenuation_radius | Required parameter | The new attenuation radius |
See also GetAttenuationRadius.
Optimal

SetCastShadows
Sets if this Light casts shadows
my_light:SetCastShadows(is_shadows_enabled)
Parameters
| Type | Parameter | Default | Description |
|---|---|---|---|
| boolean | is_shadows_enabled | Required parameter | Whether it casts shadows |
See also GetCastShadows.
Optimal

SetColor
Définir la couleur de la lumière
my_light:SetColor(color)
Parameters
| Type | Parameter | Default | Description |
|---|---|---|---|
| Color | color | Required parameter | La couleur de la lumière |
See also GetColor.
Optimal

SetIntensity
Sets the brightness of this Light
my_light:SetIntensity(intensity)
Parameters
| Type | Parameter | Default | Description |
|---|---|---|---|
| float | intensity | Required parameter | The new brightness |
See also GetIntensity.
Optimal

SetTextureLightProfile
Définit le profil de texture de la lumière
my_light:SetTextureLightProfile(light_profile)
Parameters
| Type | Parameter | Default | Description |
|---|---|---|---|
| LightProfile | light_profile | Required parameter | Le profil de lumière à utiliser |
See also 💡 Light Profiles.
🚀 Événements
Inherited Entity Events
Base Entityscripting-reference/classes/base-classes/entity
| Name | Description | |
|---|---|---|
ClassRegister | Triggered when a new Class is registered with the Inheriting System | |
Destroy | Triggered when an Entity is destroyed | |
Spawn | Triggered when an Entity is spawned/created | |
ValueChange | Triggered when an Entity has a value changed with :SetValue() |
Inherited Actor Events
Base Actorscripting-reference/classes/base-classes/actor
| Name | Description | |
|---|---|---|
DimensionChange | Déclenché lorsqu'un Actor change de dimension | |
EnterWater | Triggered when an Actor enters a water body | |
LeaveWater | Triggered when an Actor leaves a water body | |
NetworkAuthorityChange | Déclenché lorsqu'un Acteur modifie son autorité sur le réseau | |
NetworkAuthorityChange | Déclenché lorsque le joueur local gagne/perd l'autorité du réseau sur cet Acteur |
This class doesn't have own events.
💡 Profils de Lumière
Les profils lumineux sont des fichiers de textures qui décrivent la distribution d'une lumière à partir d'une source lumineuse en utilisant des données mesurées dans le monde réel.
Please check Unreal Engine Light Profile documentation for more information about Light Profiles!
nanos world provides 50 Light Profiles included in the base game which you can use to enhance your Lights. You can set them using :SetTextureLightProfile() with the enum LightProfile.

