Rain on the lens during a storm
Updated
A storm wets the camera lens and its end lets the drops dry: a Lens Drops effect kept enabled and wiped at start, driven by Storm, End storm and Wipe buttons.
Press Storm to start the rain on the lens, Wipe to clear it at once, End storm to let it dry. Drag to orbit the camera, scroll to zoom.
Rain on the lens during a storm
#pragma lifecycle(startup)
function startup() { const drops = findEntity('Main Camera').getComponent(LensDropsEffectComponent); drops.clear(0);
on('storm/start', (data) => { const heavy = data?.heavy === true; drops.setProps({ duration: 0, rate: heavy ? 60 : 20, gravity: heavy ? 1.5 : 1, advance: 3, }); drops.play(); });
on('storm/end', () => drops.stop()); on('player/wipe-visor', () => drops.clear(0.5));}How it works
Section titled “How it works”The script is explained step by step in Rain on the lens during a storm.
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.
StormLens.xrproj