Shadow
Updated
Lets the entity’s meshes cast and/or receive shadows from lights.
- Type
comp-shadow- Script class
ShadowComponent- Per entity
- One
- Version
- 1.0.0
Read about it in Shadows: what it does, how to use it from a script, and examples.
Events
Section titled “Events”Sent to the entity’s Signal Emitter as { entityId, eventType, data }. Compare eventType with the EventType constants.
Shadow::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
Configure shadows when the scene startsAt startup a script switches on a lamp's shadow map, lets a crate receive shadows and gives the floor a soft contact shadow: Light Shadow, Shadow and Contact Shadow components set from a Behavior script.
Orbit around to see the lamp's shadows and the soft contact shadows under each object. 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(ShadowComponent); if (component) log(component.props);}