Skip to content

Jump only while touching the ground

Updated

A ball counts its solid contacts from collision-enter and collision-exit, and Space kicks it upwards only while it touches something, so it cannot jump again in mid-air.

Click the scene, then press Space to make the ball jump. Pressing again in mid-air does nothing. Drag to orbit the camera, scroll to zoom.

Jump only while touching the ground

The script is explained step by step in Jump only while touching the ground.

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.

GroundedJump.xrproj