Contact Shadow
Updated
Soft shadow from straight above that grounds objects without any light.
- Type
comp-contact-shadow- Script class
ContactShadowComponent- Per entity
- One
- Version
- 1.1.0
Read about it in Shadows: 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 |
|---|---|---|
blur |
0 ≤ x ≤ 4 |
|
height |
0. |
|
opacity |
0 ≤ x ≤ 1 |
|
range |
0 ≤ x ≤ 1000 |
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(ContactShadowComponent); if (component) log(component.props);}