Dip the view on landing
Updated
Your first moving player: a first-person camera with a Character Controller walks, runs and jumps; the script plays a Camera Impact each time the character lands.
Click the view to look around with the mouse. Walk with WASD, run with Shift, and press Space to jump: the view dips as you land.
Dip the view on landing
#pragma lifecycle(startup)
function startup() { const impact = self.parent.getComponent(CameraImpactEffectComponent);
on('player', (event) => { if (event.eventType !== EventType.CharacterController.StateChange) return; // Leaving the 'fall' state means the character just touched the ground. if (event.data.previous === 'fall' && event.data.state !== 'jump') { impact.play(0.4, { x: 0, y: -1, z: 0 }); } });}How it works
Section titled “How it works”The script is explained step by step in Dip the view on landing.
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.
FirstLandingDip.xrprojWhat it uses
Section titled “What it uses”- Camera Perspective
- Main Camera
- First Person Controller
- Character Controller
- Camera Impact
- Spawn Point
- Signal Emitter
- Behavior