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 ;).
Usage¶
local MyLight = Light(
Vector(-152, 245, 115),
Rotator(0, 90, 90), -- Relevant only for Rect and Spot light types
Color(1, 0, 0), -- Red Tint
0, -- Point Light type
100, -- Intensity
250, -- Attenuation Radius
0, -- Cone Angle (Relevant only for Spot light type)
0, -- Inner Cone Angle Percent (Relevant only for Spot light type)
0, -- 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¶
Type |
Name |
Default |
Location |
Vector(0, 0, 0) |
|
Rotation |
Rotation(0, 0, 0) |
|
Color |
Color(1, 1, 1, 1) |
|
LightType (0 - Point, 1 - Spot, 3 - Rect) |
0 (Point) |
|
Intensity |
30 |
|
AttenuationRadius |
250 |
|
Cone Angle |
0 |
|
Inner Cone Angle Percent (0-1) |
0 |
|
Max Daw Distance |
0 |
|
CastShadows |
true |
|
UseInverseSquaredFalloff |
true |
|
Enabled |
true |
Functions¶
Functions (Inherited from Actor)¶
Returns |
Name |
Description |
|
AddImpulse(Vector Force) |
Applies a Force in world coordinate on this Actor (the force is applied on Client side, by the (in most of cases) the closest player of this object) |
||
AttachTo(Actor Other, string BoneName, Vector RelativeLocation, Rotator RelativeRotation) |
Attaches this Actor to any other Actor with a Relative Offset/Rotation |
||
Destroy() |
Destroys this Actor |
||
SetCollision(number CollisionType) |
Sets the actor’s collision (0 - Normal, 1 - Static Only, 2 - No Collision) |
||
SetGravityEnabled(boolean NewGravity) |
Sets the actor’s gravity enabled |
||
SetHighlightEnabled(boolean Enabled) |
Sets if this Actors is Highlighting |
||
SetInitialLocation(Vector NewInitialLocation) |
Sets the initial location |
||
SetLocation(Vector NewLocation) |
Sets the actor’s location in the game world |
||
SetRotation(Rotator NewRotation) |
Sets the actor’s rotation in the game world |
||
SetScale(Vector Scale) |
Sets the actor’s scale |
||
SetTintColor(Color NewTintColor) |
Sets the tint color, for completely paint an object, multiply the color by 10 or 100 |
||
SetValue(string Key, any Value) |
Sets a value in this entity, which can be accessed by any package (local only) |
||
Smoothly moves this actor to a Location with a certain Speed |
|||
Smoothly rotates this actor to a Rotation with a certain Speed |
|||
IsGravityEnabled() |
Gets the actor’s gravity enabled |
||
IsValid() |
Returns if this is Valid |
||
GetCollision() |
Gets the current actor’s collision |
||
GetID() |
Gets the network ID of this entity (same in both client and server) |
||
GetLocation() |
Get the actor’s position in the game world |
||
GetInitialLocation() |
Gets the initial location |
||
GetRotation() |
Gets the actor’s rotation in the game world |
||
GetScale() |
Gets the actor’s scale |
||
GetTintColor() |
Gets the Tint Color |
||
GetType() |
Returns the type of this Actor |
||
any |
GetValue(string Key) |
Gets a value given a key |
|
GetVelocity() |
Returns the current actor Velocity |