Spot Light
Updated
A cone of light aimed by the entity’s rotation.
- Type
comp-spot-light- Script class
SpotLightComponent- Per entity
- One
- Version
- 1.2.0
Read about it in Lights: what it does, how to use it from a script, and examples.
Properties
Section titled “Properties”The props the runtime declares for this component, with their defaults and accepted ranges.
| Prop | Default | Range |
|---|---|---|
angle |
0 ≤ x ≤ 1. |
|
decay |
0 ≤ x ≤ 10 |
|
distance |
0 ≤ x ≤ 1000 |
|
intensity |
0 ≤ x ≤ 100000 |
|
penumbra |
0 ≤ x ≤ 1 |
Events
Section titled “Events”Sent to the entity’s Signal Emitter as { entityId, eventType, data }. Compare eventType with the EventType constants.
SpotLight::change
Live example
Section titled “Live example”Run it in the browser, read its scripts, and download it as an XR Creator project.
Live example
Fade a light in and outA script under a spot light tweens its intensity down to 0 and back up to 3, two seconds each way, for as long as it runs.
Watch the spot fade out and back in. Drag to orbit the camera, scroll to zoom.
From a script
Section titled “From a script”#pragma lifecycle(startup)
function startup() { const component = self.parent.getComponent(SpotLightComponent); if (component) log(component.props);}