A glossy floor that reflects the scene
Updated
The floor of the runtime’s Dynamic Bones demo: a Reflector material that mirrors the shapes bobbing over it, fading their reflection with height. The script raises and lowers the reflection strength.
Watch the shapes bob over their reflections, and the floor turn from satin to mirror and back. Drag to orbit the camera, scroll to zoom.
A glossy floor that reflects the scene
#pragma lifecycle(startup, update)
const NAMES = ['Amber Ball', 'Sky Box', 'Violet Torus'];let floor;let shapes = [];let mirror = false;let next = 3;
function startup() { floor = findEntity('Mirror Floor').getComponent(ReflectorMaterialComponent); shapes = NAMES.map((name) => { const entity = findEntity(name); return { entity, y: entity.position.y }; }); log('Reflection strength', floor.props.strength);}
function update(dt, time) { for (const [i, { entity, y }] of shapes.entries()) { entity.position.y = y + Math.sin(time * 1.3 + i * 2) * 0.25; entity.rotation.y = time * 0.5; } if (time < next) return; next = time + 3; mirror = !mirror; // A sharp mirror skips the blur passes; the satin look blurs and fades with height. floor.setProps(mirror ? { strength: 1, roughness: 0, blur: 0, color: '#cbd5e1' } : { strength: 0.65, roughness: 0.25, blur: 0.5, color: '#3f4b5e' }); log(mirror ? 'Mirror' : 'Satin');}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.
MirrorFloor.xrproj