An overview of the demo applications
Demo applications are provided to showcase certain features of Jolt JNI in desktop environments.
The following demos are found in the com.github.stephengold.sportjolt.javaapp.demo package of the Sport-Jolt "java-apps" sub-project:
-
Botany
demonstrates Cosserat rods
-
MarbleGame
demonstrates compound shapes and sensor bodies
-
NewtonsCradle
demonstrates dynamic restitution and distance constraints
-
Pachinko
demonstrates compound shapes and 2-D physics
-
ThousandCubes
demonstrates stacking cubes and launching projectiles
-
Windlass
demonstrates rope simulation using rigid bodies
How to build and run the demos from source
-
Install build software:
-
a Java Development Kit (JDK), version 17 or higher
-
-
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".)-
using Bash or Zsh:
export JAVA_HOME="
path to installation"
-
using Fish:
set -g JAVA_HOME "
path to installation"
-
using PowerShell:
$env:JAVA_HOME = '
path to installation'
-
using Windows Command Prompt:
set JAVA_HOME="
path to installation"
-
-
Download and extract the source code from GitHub:
-
using Git:
-
cd sport-jolt
-
git checkout -b latest 0.9.7
-
-
Edit the "gradle.properties" file to configure the build. To run CPU-intensive demos like
Botany
andThousandCubes
, I recommend configuring "assertions=false" and "btf=ReleaseSp". -
Run the Gradle wrapper on the desktop build script:
-
using Bash or Fish or PowerShell or Zsh:
./gradlew build
-
using Windows Command Prompt:
.\gradlew build
-
-
To run (for example) the
MarbleGame
demo:-
using Bash or Fish or PowerShell or Zsh:
./gradlew :java-apps:MarbleGame
-
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.
Camera rotation:
-
Botany
andThousandCubes
useImmediate
rotation mode. Any mouse motion rotates the camera. -
NewtonsCradle
,Pachinko
, andWindlass
useDragLMB
rotation mode. You can rotate the camera by dragging the mouse with its left button depressed.
Camera translation:
-
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
Botany
:-
E launch a red ball
-
-
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
-