Appearance
Light
A light in the running scene.
Reached via entity.representation.light on a light representation, whether the author placed it or a script created it with createSpotLight(...), createPointLight(...) or createDirectionalLight(...). Returns null for any other representation kind.
Writes are runtime state: they change the running scene, not the saved experience. A property that belongs to another light type reads as 0 and warns when written.
Properties
attenuationRadius
- Type: number
- The distance in metres at which the light's contribution reaches zero. Spot and point only – a directional light shines from infinitely far away.
color
- Type: Color
- The colour the light emits. White leaves surfaces their own colour.
falloffExponent
- Type: number
- How quickly the light fades with distance. 2 is physically correct; lower carries further. Spot and point only.
innerAngle
- Type: number
- The cone that receives the light's full intensity, in degrees. Spot only; reading it on another type returns 0 and writing is ignored with a warning. Clamped to the outer angle, which is what the renderer requires.
intensity
- Type: number
- Brightness. Lumens for a spot or point light, lux for a directional one, so the same number means different things across the three.
outerAngle
- Type: number
- The cone at which the light has fallen to nothing, in degrees. Between the two angles it fades. Spot only.
projectedTextureOffset
- Type: Vector2
- Shifts the projected texture within the cone. Spot only, and only where
environment.features.has('projectedLightTexture')is true.
projectedTextureRotation
- Type: number
- Rotation of the projected texture within the cone, in radians. Spot only, and only where
environment.features.has('projectedLightTexture')is true.
projectedTextureScale
- Type: Vector2
- Tiles the projected texture within the cone,
1, 1being the authored size. Spot only, and only whereenvironment.features.has('projectedLightTexture')is true.
type
- Type: string
- Which light this is:
"spot","point"or"directional". Read-only – the three types take different parameters, so switching one for another is creating a different light.