Fly freely with the Fly controller
Updated
A Fly controller lets the camera move anywhere, ignoring gravity: WASD to fly, drag to look. The script switches between a gentle and a fast speed when you press F.
Click the view, then fly with WASD and drag to look around the ring of pillars; press F to switch between slow and fast flight.
Fly freely with the Fly controller
#pragma lifecycle(startup, update)
let fly;let orb;let fast = false;
function startup() { fly = CameraDirector.main.getComponent(FlyControllerComponent); orb = findEntity('Amber Orb'); log('Flying at', fly.props.moveSpeed, 'm/s. Press F to go faster.');}
function update(dt) { orb.rotation.y += dt * 0.5; if (!Input.keyboard.isKeyReleased(Key.F)) return; fast = !fast; fly.setProps({ moveSpeed: fast ? 12 : 3 }); log(fast ? 'Fast: 12 m/s' : 'Slow: 3 m/s');}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.
FlyThrough.xrproj