/jolt-java

Java bindings for JoltPhysics

Primary LanguageJavaMIT LicenseMIT

JoltJava

License CI Release Snapshot

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

These bindings are still feature-incomplete and unstable.

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("io.github.aecsocket", "jolt-java", "VERSION")
    runtimeOnly("io.github.aecsocket", "jolt-java-natives-linux-x86", "VERSION")
    runtimeOnly("io.github.aecsocket", "jolt-java-natives-windows-x86", "VERSION")
    runtimeOnly("io.github.aecsocket", "jolt-java-natives-macos-x86", "VERSION")
}

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/aecsocket/jolt-java
cd jolt-java
./gradlew build