An overview of the demo applications

Demo applications are provided to showcase certain features of Jolt JNI in desktop environments.

  • MarbleGame demonstrates compound shapes and sensor bodies
    marbleGame

  • NewtonsCradle demonstrates dynamic restitution and distance constraints
    newtonsCradle

  • Pachinko demonstrates compound shapes and 2-D physics
    pachinko

  • ThousandCubes demonstrates stacking cubes and launching projectiles
    thousandCubes

  • Windlass demonstrates rope simulation using rigid bodies
    windlass

How to build and run the demos from source

  1. Install build software:

    1. a Java Development Kit (JDK), version 11 or higher

  2. Point the JAVA_HOME environment variable to your JDK installation: (The path might look something like "C:\Program Files\Eclipse Adoptium\jdk-17.0.3.7-hotspot" or "/usr/lib/jvm/java-17-openjdk-amd64/" or "/Library/Java/JavaVirtualMachines/zulu-17.jdk/Contents/Home".)

    1. using Bash or Zsh: export JAVA_HOME=" path to installation "

    2. using Fish: set -g JAVA_HOME " path to installation "

    3. using PowerShell: $env:JAVA_HOME = ' path to installation '

    4. using Windows Command Prompt: set JAVA_HOME=" path to installation "

  3. Download and extract the source code from GitHub:

    1. using Git:

      1. git clone https://github.com/stephengold/sport-jolt.git

      2. cd sport-jolt

      3. git checkout -b latest 0.9.6

  4. Edit the "gradle.properties" file to configure the build.

  5. Run the Gradle wrapper on the desktop build script:

    1. using Bash or Fish or PowerShell or Zsh: ./gradlew build

    2. using Windows Command Prompt: .\gradlew build

  6. To run (for example) the MarbleGame demo:

    1. using Bash or Fish or PowerShell or Zsh: ./gradlew :java-apps:MarbleGame

    2. using Windows Command Prompt: .\gradlew :java-apps:MarbleGame

User interface

The demos are controlled primarily by keyboard input.

The descriptions below assume a keyboard with the "US" (QWERTY) layout. On keyboards with other layouts, the keys may be labeled differently.

For convenience, the mapping of keys to actions is partly standardized. In most demo apps:

  • . and Pause toggle the simulation between running and paused,

  • C dumps the camera’s position to the console, and

  • Esc ends the application.

For camera control, all demos except MarbleGame and ThousandCubes use DragLMB rotation mode. This means you can rotate the camera by dragging the mouse with its left button depressed. Furthermore:

  • W and S dolly the camera forward and back, respectively,

  • A and D dolly the camera left and right, respectively,

  • Q raises the camera, and

  • Z lowers the camera.

Additional key mappings are specific to each application:

  • In MarbleGame:

    • W and Up arrow push the marble away from the viewer

    • S and Down arrow push the marble towards the viewer

    • A and Left arrow push the marble to the viewer’s left

    • D and Right arrow push the marble to the viewer’s right

  • In NewtonsCradle:

    • F1, 1, and Numpad1 restart with a single ball

    • F2, 2, and Numpad2 restart with 2 balls

    • F3, 3, and Numpad3 restart with 3 balls

    • F4, 4, and Numpad4 restart with 4 balls

    • F5, 5, and Numpad5 restart with 5 balls

  • In Pachinko:

    • F4, 4, and Numpad4 restart with 4 rows of pins

    • F5, 5, and Numpad5 restart with 5 rows of pins

    • F6, 6, and Numpad6 restart with 6 rows of pins

    • F7, 7, and Numpad7 restart with 7 rows of pins

    • F8, 8, and Numpad8 restart with 8 rows of pins

    • F9, 9, and Numpad9 restart with 9 rows of pins

  • In ThousandCubes:

    • E launch a red ball

  • In Windlass:

    • Down arrow turn the barrel counter-clockwise

    • Up arrow turn the barrel clockwise