A jump pad
Updated
A sensor pad that sets the vertical velocity of every dynamic body entering it, so light and heavy bodies leave at the same speed.
Watch the bodies bounce on the pad. Drag one off the pad or back onto it.
A jump pad
#pragma lifecycle(startup)
const LAUNCH_SPEED = 9; // metres per second, upwards
function startup() { on('pad', (event) => { if (event.eventType !== EventType.PhysicsCollider.IntersectionEnter) return; const other = findEntity(event.data.otherEntityId || ''); const body = other?.getComponent(PhysicsRigidBodyComponent); if (!body || body.bodyType !== 'dynamic') return;
const v = body.linearVelocity(); body.setLinearVelocity({ x: v.x, y: LAUNCH_SPEED, z: v.z }); });}How it works
Section titled “How it works”The script is explained step by step in A jump pad.
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.
JumpPad.xrproj