Skip to main content
Version: latest - a1.0.0 ⚖️

💡 Light

A Light represents a Lighting source.

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 ;).


You can spawn this entity is both Client or Server (if you spawn it on client, it won’t be synchronized with other players).


Inheritance: This class inherits from Actor. Please check it's pages for inherited Methods and Events.


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
Base Actorscripting-reference/classes/base-classes/actor
AddImpulseApplies a Force in world coordinate on this Actor
AttachToAttaches this Actor to any other Actor
DestroyDestroys this Actor
DetachDetaches this Actor if attached
SetCollisionSets the actor’s collision type
SetForceAdds a permanent force to this actor
SetGravityEnabledSets the actor’s gravity enabled
SetHighlightEnabledEnables this Actor Highlighting at a specific Index color
SetLifeSpanSets the actor’s life span to be destroyed
SetLocationSets the actor’s location in the game world
SetNetworkAuthoritySets this actor’s new Player Network Authority
SetRelativeLocationSets the actor’s relative location in local space
SetRelativeRotationSets the actor’s relative rotation in local space
SetRotationSets the actor’s rotation in the game world
SetScaleSets the actor’s scale
SetValueSets a value in this entity, which can be accessed by any package
TranslateToSmoothly moves this actor to a Location
RotateToSmoothly rotates this actor to a Rotation
booleanIsGravityEnabledGets the actor’s gravity enabled
booleanIsInWaterGets if the actor is in Water
booleanIsNetworkDistributedGets if the actor is Network Distributed
booleanIsValidReturns if this entity is valid (i.e. not destroyed)
tableGetAttachedEntitiesGets all actors attached to this entity
anyGetAttachedToGets the actor this actor is attached to
tableGetBoundsGets the actor bounds size
numberGetCollisionGets the current actor’s collision
numberGetIDGets the universal network ID of this entity
VectorGetLocationGet the actor’s position in the game world
VectorGetInitialLocationGets the initial location
RotatorGetRotationGets the actor’s rotation in the game world
VectorGetScaleGets the actor’s scale
stringGetTypeReturns the type of this Actor
anyGetValueGets a value given a key
VectorGetVelocityReturns the current actor Velocity
SubscribeSubscribes for an Event
UnsubscribeUnsubscribes from Events
SetColorSets the light color


Sets the light color

TypeParameterDefault ValueDescription
ColorcolorThe light color


Inherited Actor Events
Base Actorscripting-reference/classes/base-classes/actor
DestroyTriggered when an Entity is Destroyed
SpawnTriggered when an Entity is Spawned/Created
ValueChangeTriggered when an Entity has it’s value changed