Skip to content

stephengold/jolt-java

 
 

Repository files navigation

JoltJava

Java bindings for JoltPhysics with C bindings based on zig-gamedev JoltPhysicsC

This project is no longer being developed.

The bindings are feature-incomplete and unstable.

Please use jolt-jni instead.

Coverage

Features:

  • Rigid bodies
    • Body interface
    • Body locking
    • Motion properties
  • Shapes
    • Convex
    • Compound
    • Decorator
    • Mesh/height field
  • Queries
    • Broad phase
    • Narrow phase
  • Listeners
    • Step
    • Contact
  • Double precision
  • Constraints
    • Two-body constraints
  • Vehicles
  • Ragdolls
  • Characters

Platforms:

  • Linux (x86_64)
  • Windows (x86_64)
  • MacOS (x86_64)

Build types (change with Gradle flag -PbuildType= or property buildType):

  • debug
  • release
  • distribution (default)

Flavors (change with Gradle flag -PbuildFlavor= or property buildFlavor):

  • sp (single-precision floating point, default)
  • dp (double-precision floating point)

Usage

repositories {
    mavenCentral()
}

dependencies {
    implementation("com.github.stephengold", "jolt-java", "0.1.0")
    runtimeOnly("com.github.stephengold", "jolt-java-natives-linux-x86", "0.1.0")
}

Usage is very similar to JoltPhysics. See HelloJolt.java to get a minimal implementation.

Note: these bindings are fairly low-level. For some classes such as the vector and matrix classes, you are expected to write your own wrappers around them.

Setup

// Load the native libraries from the jar (in `jolt/`)
Jolt.load();
// Or load them manually
// System.load("name-of-lib-file");

// Do some Jolt setup
Jolt.registerDefaultAllocator();
Jolt.createFactory();
Jolt.registerTypes();

Building from source

On Windows, you need Ninja installed.

git clone https://github.com/stephengold/jolt-java
cd jolt-java
./gradlew build