Ir para o conteúdo principal
Version: latest - a1.7.0 ⚖️

💡 Light

A Light represents a Lighting source.


🟦🟧 Authority: This class can be spawned on both Client and Server (if you spawn it on client, it won't be synchronized with other players).

Inheritance: This class inherits from Actor.

nanos world provides 3 types of lights: Spot, Point and Rect. All lights are Dynamic and because of that, very expensive! Keep that in mind before spawning 1000 lights 😉.


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?

Constructor Parameters

VectorlocationVector(0, 0, 0)
RotatorrotationRotator(0, 0, 0)Relevant only for Rect and Spot LightTypes
ColorcolorColor(1, 1, 1)
numbercone_angle44Relevant only for Spot LightType
numberinner_cone_angle_percent0Inner Cone Angle Percent (Relevant only for Spot LightType) (0-1)
numbermax_daw_distance5000Max Draw Distance (Good for performance - 0 for infinite
booleanuse_inverse_squared_fallofftrueWhether to use physically based inverse squared distance falloff, where Attenuation Radius is only clamping the light's contribution. (Spot and Point types only)


Inherited Actor Functions
AddImpulseApplies a Force in world space to this Actor
AttachToAttaches this Actor to another Actor
DestroyDestroys this Actor
DetachDetaches this Actor if attached
SetCollisionSets this Actor's collision type
SetForceAdds a permanent force to this Actor
SetGravityEnabledSets whether gravity is enabled on this Actor
SetVisibilitySets the Actor visibility
SetHighlightEnabledSets whether the highlight is enabled on this Actor, and which highlight index to use
SetOutlineEnabledSets whether the outline is enabled on this Actor, and which outline index to use
SetLifeSpanSets the time (in seconds) before this Actor is destroyed
SetLocationSets this Actor's location in the game world
SetNetworkAuthoritySets the Player this Actor will have its physics calculated on Network Authority
SetRelativeLocationSets this Actor's relative location in local space
SetRelativeRotationSets this Actor's relative rotation in local space
SetRotationSets this Actor's rotation in the game world
SetScaleSets this Actor's scale
SetValueSets a value in this Actor, which can be accessed by any package
TranslateToSmoothly moves this Actor to the specified location
RotateToSmoothly rotates this Actor to the specified angle
booleanHasNetworkAuthorityGets if the LocalPlayer is currently the Network Authority of this Actor
booleanHasAuthorityGets if this Actor was spawned by the client side
booleanIsBeingDestroyedGets if this Actor is being destroyed
booleanIsGravityEnabledGets whether gravity is enabled on this Actor
booleanIsVisibleGets whether this actor is Visible or not
booleanIsInWaterGets if this Actor is in water
booleanIsNetworkDistributedGets if this Actor is currently Network Distributed
booleanIsValidReturns if this Actor is valid (i.e. not destroyed)
tableGetAttachedEntitiesGets all Actors attached to this Actor
anyGetAttachedToGets the Actor this Actor is attached to
tableGetBoundsGets this Actor's bounds
numberGetCollisionGets this Actor's collision type
numberGetIDGets the universal network ID of this Actor
VectorGetLocationGets this Actor's location in the game world
RotatorGetRotationGets this Actor's angle in the game world
VectorGetForceGets this Actor's scale
VectorGetScaleGets this Actor's scale
stringGetTypeGets the type of this Actor
anyGetValueGets a value stored on this Actor at the given key
VectorGetVelocityReturns this Actor's current velocity
stringAddActorTagAdds an Unreal Actor Tag to this Actor
stringRemoveActorTag`Remove an Unreal Actor Tag from this Actor
tableGetActorTagsGets all Unreal Actor Tags from this Actor
functionSubscribeSubscribes to an Event
UnsubscribeUnsubscribes from an Event
SetColorSets the light color
SetTextureLightProfileSets the light texture profile
SetEnabledEnables/Disables the light
SetCastShadowsEnables/Disables the shadows
SetIntensitySets the intensity
SetAttenuationRadiusSets the Attenuation Radius


Sets the light color

TypeParameterDefault ValueDescription
ColorcolorThe light color


Sets the light Texture Profile

TypeParameterDefault ValueDescription
LightProfilelight_profileThe Light Profile to use


TypeParameterDefault ValueDescription


TypeParameterDefault ValueDescription


TypeParameterDefault ValueDescription


TypeParameterDefault ValueDescription


Inherited Actor Events
DestroyTriggered when an Actor is destroyed
SpawnTriggered when an Actor is spawned/created
ValueChangeTriggered when an Actor has a value changed with :SetValue()

Light Profiles

Light Profiles are texture files which describes a light's distribution from a light source using real world measured data.


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.