Pin Light
The Pin 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. |
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. |
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("Pin Light"); log(light.color().x); // result: the red component of the light's color.
intensity()
Returns the intensity of the Light.
Returns
number The intensity of the Light. Range is 0-1000.
isRemoved()
Returns if the Light is removed.
Returns
boolean true if the Light is removed, false if the Light is not.
isVisible()
Returns if the Light is visible.
Returns
boolean true if the Light is visible, false if the Light is not.
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.
range()
Returns the range of the Light. The range is how far the light reaches.
Returns
Number The range of the Light.
remove()
Remove the Light from the Scene.
rotation()
Returns the rotation of the Light in degrees.
Returns
Vec3 The {x, y, z} rotation value of the Light, in degrees.
rotationQuat()
Returns the rotation of the Light in Quaternion.
Returns
Quaternion The rotation value in Quaternion.
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
setIntensity(value)
Sets the intensity of the Light.
Parameters
Number value – the intensity of the Light, ranging from 0-1000.
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
setRange(value)
Sets the range of the Light.
Parameters
Number value – the range of the Light
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
setRotationQuat(value)
Sets rotation value in Quaternion.
Parameters
Quaternion value – The Quaternion rotation value to be set
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.
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.
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("Pin Light")[0].worldPosition();
log('X World Position = ' + pos.x);