Ground an object over the sky with a shadow catcher
Updated
A balloon floats over a day sky with no visible floor: a Matte Shadow material catches only its shadow, so it still reads as standing on the ground. The script bobs it so the shadow grows and shrinks.
Watch the shadow on the invisible ground follow the balloon. Drag to orbit the camera, scroll to zoom.
Ground an object over the sky with a shadow catcher
#pragma lifecycle(startup, update)
let balloon;
function startup() { balloon = findEntity('Balloon Dog'); const catcher = findEntity('Shadow Catcher').getComponent(MatteShadowMaterialComponent); log('Shadow opacity', catcher.props.opacity);}
function update(dt, time) { balloon.position.y = 0.6 + (Math.sin(time * 1.2) + 1) * 0.35; balloon.rotation.y = 0.6 + time * 0.4;}Open it in XR Creator
Section titled “Open it in XR Creator”Download the project file below, then import it in XR Hub with Projects › New › Import, as described in Projects and templates. It opens in XR Creator with the same scene you see running above, each script already attached to its Behavior entity. From there you can edit the scripts, adjust components and their props, preview your changes, and deploy the result as a world of your own.
ShadowCatcher.xrproj