jolt-java
jolt-java copied to clipboard
Java bindings for JoltPhysics
These bindings are still feature-incomplete and unstable.
Coverage
Features:
- [x] Rigid bodies
- [x] Body interface
- [x] Body locking
- [x] Motion properties
- [x] Shapes
- [x] Convex
- [x] Compound
- [x] Decorator
- [x] Mesh/height field
- [x] Queries
- [x] Broad phase
- [x] Narrow phase
- [x] Listeners
- [x] Step
- [x] Contact
- [x] Double precision
- [ ] Constraints
- [x] Two-body constraints
- [ ] Vehicles
- [ ] Ragdolls
- [ ] Characters
Platforms:
- [x] Linux (x86_64)
- [ ] Windows (x86_64)
- [ ] MacOS (x86_64)
Build types (change with Gradle flag -PbuildType= or property buildType):
debugreleasedistribution(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