A high striker on a Prismatic Joint
Updated
A fairground high striker: the puck rides a Prismatic Joint that lets it slide only along the pole. Every few seconds the script strikes it upward with a random impulse and logs how high it went; a hard hit rings the bell.
Watch the puck shoot up the pole and slide back down, staying on its axis whatever the impulse. Drag to orbit the camera, scroll to zoom.
A high striker on a Prismatic Joint
#pragma lifecycle(startup, update)
let puck;let entity;let best = 0;let timer = 1;
function startup() { entity = findEntity('Puck'); puck = entity.getComponent(PhysicsRigidBodyComponent); const slide = findEntity('Striker').getComponent(PhysicsPrismaticJointComponent); log('The puck slides along', JSON.stringify(slide.props.axis ?? { x: 0, y: 1, z: 0 }));}
function update(dt) { best = Math.max(best, entity.position.y); timer -= dt; if (timer > 0) return; timer = 3.5; if (best > 0.5) log(best > 3.1 ? 'DING! The bell rings' : `Reached ${best.toFixed(2)} m`); best = 0; // The joint cancels any sideways part of the push. puck.wakeUp(); puck.applyImpulse({ x: Random.range(-1, 1), y: Random.range(5, 8.5), z: 0 });}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.
HighStriker.xrproj