wiki.sine.space | sinespace

Difference between revisions of "Scripting/SLight"

From wiki.sine.space
Jump to: navigation, search
(Added code examples for Color, Type)
Line 5: Line 5:
 
{{ScriptFunction|float|Range|{ get; set;}|Get/Set the effective range of the light source.|5=-- Change the range of the Light --<br>Space.Host.ExecutingObject.Light.Range = 8.0;}}
 
{{ScriptFunction|float|Range|{ get; set;}|Get/Set the effective range of the light source.|5=-- Change the range of the Light --<br>Space.Host.ExecutingObject.Light.Range = 8.0;}}
 
{{ScriptFunction|float|Intensity|{ get; set;}|Get/Set the intensity of the light source. (Multiplied with the light color)|5=-- Get the intensity of the Light --<br>Space.Log("Intensity: " .. Space.Host.ExecutingObject.Light.Intensity);}}
 
{{ScriptFunction|float|Intensity|{ get; set;}|Get/Set the intensity of the light source. (Multiplied with the light color)|5=-- Get the intensity of the Light --<br>Space.Log("Intensity: " .. Space.Host.ExecutingObject.Light.Intensity);}}
{{ScriptFunction|SVector|Color|{ get; set;}|Get/Set the color of the light.}}
+
{{ScriptFunction|SVector|Color|{ get; set;}|Get/Set the color of the light.|5=
{{ScriptFunction|SLightType|Type|{ get; set;}|Get/Set the type of light this source is.}}
+
local obj = Space.Host.ExecutingObject;<br><br>
 +
Space.Log(obj.Light.Color);<br>
 +
''-- prints "[1,1,1]" (white) to the console.''<br>
 +
local newColor = Vector.New(0.5,0.5,0); ''-- yellow color''<br>
 +
obj.Light.Color = newColor;<br>
 +
''-- Now the color of the light is yellow.''}}
 +
{{ScriptFunction|SLightType|Type|{ get; set;}|4= Get/Set the type of light this source is. 0 = Directional, 1 = Point, 2 = Spot, 3 = Area.|5=
 +
local obj = Space.Host.ExecutingObject;<br><br>
 +
Space.Log(obj.Light.Type);<br>
 +
''-- prints "1" (default) to the console.''<br>
 +
obj.Light.Type = 0;<br>
 +
''-- Now the light type has changed to Directional.''}}
  
  
 
{{Scripting Navbox}}
 
{{Scripting Navbox}}

Revision as of 07:41, 25 July 2017

Light sources within the Space scene.

Properties

Enabled

bool Enabled { get; set;}

Enable/Disable this light.

-- Disable this object's Light Source --
Space.Host.ExecutingObject.Light.Enabled = false;


Range

float Range { get; set;}

Get/Set the effective range of the light source.

-- Change the range of the Light --
Space.Host.ExecutingObject.Light.Range = 8.0;


Intensity

float Intensity { get; set;}

Get/Set the intensity of the light source. (Multiplied with the light color)

-- Get the intensity of the Light --
Space.Log("Intensity: " .. Space.Host.ExecutingObject.Light.Intensity);


Color

SVector Color { get; set;}

Get/Set the color of the light.

local obj = Space.Host.ExecutingObject;

Space.Log(obj.Light.Color);
-- prints "[1,1,1]" (white) to the console.
local newColor = Vector.New(0.5,0.5,0); -- yellow color
obj.Light.Color = newColor;

-- Now the color of the light is yellow.


Type

SLightType Type { get; set;}

Get/Set the type of light this source is. 0 = Directional, 1 = Point, 2 = Spot, 3 = Area.

local obj = Space.Host.ExecutingObject;

Space.Log(obj.Light.Type);
-- prints "1" (default) to the console.
obj.Light.Type = 0;

-- Now the light type has changed to Directional.