Spot Light
The Spot Light is a way to add additional light sources to your game.
Function |
Description |
color() |
Returns the color of the Light in RGB (Red, Green, Blue) format.
|
the sp
cutOffAngle() |
Returns the cutoff angle of the Spot Light, in degrees.
|
intensity() |
Returns the intensity of the Light.
|
isRemoved() |
Returns true if the Light is removed, false if not. |
isVisible() |
Returns true if the light is visible, false if not.
|
position() |
Returns the Light’s position coordinates relative to its parent.
|
range() |
Returns the range of the Light.
|
remove() |
Remove the light from the Scene.
|
rotation() |
Returns the rotation of the Light in degrees.
|
rotationQuat() |
Returns the rotation of the Light in quaternion.
|
setColor(color) |
Sets the color of the Light.
|
setCutOffAngle(value) |
Sets the cutoff angle of the Light, in degrees. This changes how wide or narrow the Spot Light is.
|
setIntensity(value) |
Sets the intensity of the Light.
|
setPosition(x, y, z) |
Sets the new position relative to the Light’s parent. If the Light has no parent, this sets the world position of the Light.
|
setRange(value) |
Sets the range of the Light.
|
setRotation(x, y, z) |
Sets the rotation value of the Light, in degrees.
|
setRotationQuat(value) |
Sets rotation value in Quaternion.
|
setVisible(value) |
Sets the visibility of the Light; true if the Light is visible, false if not.
|
setWorldPosition() |
Sets the Light’s position coordinates in the world (absolute position).
|
worldPosition() |
Returns the Light’s position coordinates in the world (absolute position).
|
color()
Returns the Light’s color in RGB (Red, Green, Blue) format. The minimum value is 0 and the maximum is 1 (think of it as the 0-255 scale divided by 255). For example, {r:0, g:0, b:0} is black and {r:1, g:1, b:1} is white.
Returns
Vec3 {x, y, z} color pigment of the Light.
let light = this.scene().findFirst("Spot Light");
log(light.color().x);
↑ Back to top
cutOffAngle()
Returns the cutoff angle of the Spot Light, in degrees.
Returns
number the cutoff angle of the Spot Light
intensity()
Returns the intensity of the Light.
Returns
number The intensity of the Light. Range is 0-1000.
↑ Back to top
isRemoved()
Returns if the Light is removed.
Returns
boolean true if the Light is removed, false if the Light is not.
↑ Back to top
isVisible()
Returns if the Light is visible.
Returns
boolean true if the Light is visible, false if the Light is not.
↑ Back to top
position()
Returns the Light’s position relative to its parent. If the Light has no parent, the result of this function will be no different than worldPosition.
Returns
Vec3 {x, y, z} relative coordinates of the Light.
↑ Back to top
range()
Returns the range of the Light. The range is how far the light reaches.
Returns
Number The range of the Light.
↑ Back to top
remove()
Remove the Light from the Scene.
↑ Back to top
rotation()
Returns the rotation of the Light in degrees.
Returns
Vec3 The {x, y, z} rotation value of the Light, in degrees.
↑ Back to top
rotationQuat()
Returns the rotation of the Light in Quaternion.
Returns
Quaternion The rotation value in Quaternion.
↑ Back to top
setColor(color)
Sets the color of the Light. Expected range of {r, g, b} is 0-1.
Parameters
Vec3 color – the {r, g, b} color
↑ Back to top
setCutOffAngle(value)
Sets the cutoff angle of the Light, in degrees. This changes how wide or narrow the Spot light is.
Parameters
number value – the cutoff angle to be used
↑ Back to top
setIntensity(value)
Sets the intensity of the Light.
Parameters
Number value – the intensity of the Light, ranging from 0-1000.
↑ Back to top
setPosition(x, y, z)
Sets the new position relative to the Light’s parent. If the Light has no parent, this sets the world position of the Light.
Parameters
number x – X coordinate in 3D space
number y – Y coordinate in 3D space
number z – Z coordinate in 3D space
↑ Back to top
setRange(value)
Sets the range of the Light.
Parameters
Number value – the range of the Light
↑ Back to top
setRotation(x, y, z)
Sets the rotation value of the Light, in degrees.
Parameters
number x – the X rotation of the Light
number y – the Y rotation of the Light
number z – the Z rotation of the Light
↑ Back to top
setRotationQuat(value)
Sets rotation value in Quaternion.
Parameters
Quaternion value – The Quaternion rotation value to be set
↑ Back to top
setVisible(value)
Sets the visibility of the Light; true if the Light is visible, false if not.
Parameters
boolean value – the visibility of the Light.
↑ Back to top
setWorldPosition(value)
Sets the Light’s position coordinates in the world (absolute position).
Parameters
Vec3 value – the {x, y, z} absolute position of the Light.
↑ Back to top
worldPosition()
Returns the Light’s position coordinates in the world (absolute position).
Returns
Vec3 the {x, y, z} world coordinates of the Light
let pos = this.scene().find("Spot Light")[0].worldPosition();
log('X World Position = ' + pos.x);
↑ Back to top