Jump pads and a high jump
Updated
The player’s Character Controller reports the sensor pads it walks into: a pad named Jump Pad launches it 4 m up, and E jumps higher than the built-in jump on Space.
Click the scene, then walk with WASD onto a green pad to be launched. Press E for a high jump and Space for the normal one. Drag to look around.
Jump pads and a high jump
#pragma lifecycle(startup, update)
const PAD_HEIGHT = 4; // metresconst HIGH_JUMP = 2.5; // metreslet character;
function startup() { // On the player's character, with a Character Controller and a Signal Emitter 'player'. character = self.parent.getComponent(CharacterControllerComponent);
on('player', (event) => { if (event.eventType !== EventType.PhysicsCollider.IntersectionEnter) return; const pad = findEntity(event.data.otherEntityId || ''); if (pad && pad.name.startsWith('Jump Pad')) character.jump(PAD_HEIGHT); });}
function update() { // E jumps higher than the built-in 1.25 m jump on Space. if (character.isGrounded && Input.keyboard.isKeyReleased(Key.E)) { character.jump(HIGH_JUMP); }}How it works
Section titled “How it works”The script is explained step by step in Jump pads and a high jump.
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.
JumpPads.xrproj