Set up a beam and a projector
Updated
At startup a script gives a spot light’s beam a faint opacity and a 6 m length, then projects an image on the wall through its Spot Light Projector.
See the faint shaft of light and the image it projects on the wall. Drag to orbit the camera, scroll to zoom.
Set up a beam and a projector
#pragma lifecycle(startup)
async function startup() { const lamp = findEntity('Logo Projector');
// A faint shaft of light that fades out where it meets the wall, 6 m away. lamp.getComponent(SpotLightBeamComponent).setProps({ opacity: 0.15, length: 6 });
// Project the logo, slightly smaller than the cone. const projector = lamp.getComponent(SpotLightProjectorComponent); projector.setProps({ src: '/example-assets/bang.png', zoom: 0.8 }); await projector.load(); log('Logo is on the wall');}How it works
Section titled “How it works”The script is explained step by step in Set up a beam and a projector.
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.
ProjectorSetup.xrproj