(Added code examples for Color, Type) |
|||
Line 3: | Line 3: | ||
=Properties= | =Properties= | ||
{{ScriptFunction|bool|Enabled|{ get; set;}|Enable/Disable this light.|5=-- Disable this object's Light Source --<br>Space.Host.ExecutingObject.Light.Enabled = false;}} | {{ScriptFunction|bool|Enabled|{ get; set;}|Enable/Disable this light.|5=-- Disable this object's Light Source --<br>Space.Host.ExecutingObject.Light.Enabled = false;}} | ||
+ | |||
{{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|SpotAngle|{ get; set;}|The angle of the light's spotlight cone in degrees.|5=light=Space.Host.ExecutingObject.AddLight();<br> | ||
+ | light.Type=2;<br> | ||
+ | light.SpotAngle=60; | ||
+ | ''--set spot angle to 60 degree.'' | ||
+ | }} | ||
+ | |||
{{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.|5= | {{ScriptFunction|SVector|Color|{ get; set;}|Get/Set the color of the light.|5= | ||
local obj = Space.Host.ExecutingObject;<br><br> | local obj = Space.Host.ExecutingObject;<br><br> | ||
Line 12: | Line 21: | ||
obj.Light.Color = newColor;<br> | obj.Light.Color = newColor;<br> | ||
''-- Now the color of the light is yellow.''}} | ''-- 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= | {{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> | local obj = Space.Host.ExecutingObject;<br><br> |
Light sources within the Space scene.
Enable/Disable this light.
Get/Set the effective range of the light source.
The angle of the light's spotlight cone in degrees.
light.Type=2;
light.SpotAngle=60;
Get/Set the intensity of the light source. (Multiplied with the light color)
Get/Set the color of the light.
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;
Get/Set the type of light this source is. 0 = Directional, 1 = Point, 2 = Spot, 3 = Area.
Space.Log(obj.Light.Type);
-- prints "1" (default) to the console.
obj.Light.Type = 0;
|