API reference
API reference
Select your platform
No SDKs available
No versions available

SceneLight Class

Modifiers: final
Represents a dynamic light in the scene that can illuminate objects with point or spot lighting.
Dynamic lights provide real-time lighting that affects PBR materials. Each light has properties for position, color, intensity, and range. Spot lights additionally have direction and cone angle properties.
The system supports up to 4 lights per object for optimal performance on Quest devices. Lights are automatically prioritized based on distance and intensity, so the most important lights affect each object.
Example usage:
// Create a point light
val light = SceneLight.createPointLight(
    position = Vector3(0f, 2f, 0f),
    color = Vector3(1f, 0.9f, 0.8f),
    intensity = 2.0f,
    range = 10f
)
// Create a spot light
val spotlight = SceneLight.createSpotLight(
    position = Vector3(0f, 3f, 0f),
    color = Vector3(1f, 1f, 1f),
    intensity = 5.0f,
    range = 15f,
    direction = Vector3(0f, -1f, 0f),
    spotOuterAngle = 45f,
    spotInnerAngle = 30f,
)
// Update light position
light?.update(position = Vector3(1f, 2f, 0f))
// Destroy when done
light?.destroy()

Signature

class SceneLight

Properties

handle : Long
[Get]
Signature
var handle: Long

Methods

destroy ()
Destroys this light and removes it from the scene.
After calling this method, SceneLight.isValid will return false and the light will no longer illuminate objects in the scene.
Signature
fun destroy(): Boolean
Returns
Boolean  true if the light was successfully destroyed, false if already destroyed or invalid
isValid ()
Returns whether this light handle is still valid.
A handle becomes invalid after SceneLight.destroy is called or if the underlying native light was removed.
Signature
fun isValid(): Boolean
Returns
Boolean  true if the light handle is valid and can be used
update ( position , range , color , intensity , direction , spotOuterAngle , spotInnerAngle , type , castsShadow )
Updates the light's properties.
All parameters are optional and default to common values. Only specify the parameters you want to change.
Signature
fun update(position: Vector3 = Vector3(0f, 0f, 0f), range: Float = 10.0f, color: Vector3 = Vector3(1f, 1f, 1f), intensity: Float = 1.0f, direction: Vector3 = Vector3(0f, -1f, 0f), spotOuterAngle: Float = 45.0f, spotInnerAngle: Float = 30.0f, type: SceneLightType = SceneLightType.Point, castsShadow: Boolean = false): Boolean
Parameters
position: Vector3  World-space position of the light
range: Float  Attenuation range in world units. Light contribution is zero beyond this distance
color: Vector3  Light color in linear RGB (not sRGB). Each component should be in 0, 1 range
intensity: Float  Light intensity multiplier. Values greater than 1 create brighter lights
direction: Vector3  Direction for spot lights (will be normalized). Ignored for point lights
spotOuterAngle: Float  Spot light outer cone angle in degrees. Light falls off to zero at this angle
spotInnerAngle: Float  Spot light inner cone angle in degrees. Light is at full intensity within this angle
type: SceneLightType  The type of light (Point or Spot)
castsShadow: Boolean  Whether this light should cast shadows (requires shadow system to be enabled)
Returns
Boolean  true if the update was successful, false if the handle is invalid

Companion Object

Methods

createPointLight ( position , range , color , intensity , castsShadow )
Creates a new point light in the scene.
Point lights emit light equally in all directions from a single point in space.
Signature
fun createPointLight(position: Vector3, range: Float = 10.0f, color: Vector3 = Vector3(1f, 1f, 1f), intensity: Float = 1.0f, castsShadow: Boolean = false): SceneLight?
Parameters
position: Vector3  World-space position of the light
range: Float  Attenuation range in world units. Light contribution is zero beyond this distance. Default is 10 units.
color: Vector3  Light color in linear RGB (not sRGB). Default is white (1, 1, 1)
intensity: Float  Light intensity multiplier. Default is 1.0
castsShadow: Boolean  Whether this light should cast shadows. Default is false
Returns
SceneLight?  A new SceneLight instance, or null if creation failed (e.g., max lights reached)
createSpotLight ( position , direction , range , color , intensity , spotOuterAngle , spotInnerAngle , castsShadow )
Creates a new spot light in the scene.
Spot lights emit light in a cone from a point in a given direction.
Signature
fun createSpotLight(position: Vector3, direction: Vector3, range: Float = 10.0f, color: Vector3 = Vector3(1f, 1f, 1f), intensity: Float = 1.0f, spotOuterAngle: Float = 45.0f, spotInnerAngle: Float = 30.0f, castsShadow: Boolean = false): SceneLight?
Parameters
position: Vector3  World-space position of the light
direction: Vector3  Direction the spot light points (will be normalized)
range: Float  Attenuation range in world units. Light contribution is zero beyond this distance. Default is 10 units.
color: Vector3  Light color in linear RGB (not sRGB). Default is white (1, 1, 1)
intensity: Float  Light intensity multiplier. Default is 1.0
spotOuterAngle: Float  Outer cone angle in degrees. Light falls off to zero at this angle. Default is 45 degrees.
spotInnerAngle: Float  Inner cone angle in degrees. Light is at full intensity within this angle. Default is 30 degrees.
castsShadow: Boolean  Whether this light should cast shadows. Default is false
Returns
SceneLight?  A new SceneLight instance, or null if creation failed (e.g., max lights reached)