Minie v8 physics libraries

A new version of the Minie physics library was released last night (14 February).

  • There are some API changes, but they’re unlikely to impact your applications. See the release notes for details.

  • The “+big3” build flavor has been replaced by a “+big4” flavor which supports the four 64-bit desktop platforms: Linux64, MacOSX64, MacOSX_ARM64, and Windows64. (Other build flavors are unaffected by this change.)

  • The CharacterControl.onGround() bug reported last month by @SrGnis is fixed in v8.0.0 .

  • The code to generate JME meshes from collision shapes was overhauled to make it more efficient. Previously mesh triangles were copied from native Bullet one vertex at a time, after which vertices were re-indexed by Java code. The new approach reduces the number of JNI calls and leverages any indices generated by native code.

For Gradle projects, the upgrade procedure is straightforward. Here is a typical buildscript:

repositories {
    mavenCentral()
}
dependencies {
    implementation 'com.github.stephengold:Minie:8.0.0'
}

Version 8.0.0 introduces an exciting feature: custom collision shapes. (This is a feature of jme3-jbullet that Minie previously lacked.) By extending the new CustomConvexShape class, you can define collision shapes in Java (or another JVM language).

Your code defines:

  • where the shape’s surface lies (by calculating the support location for any given normal direction),
  • the shape’s moment of inertia, and
  • how scalable the shape is.

This technique allows you to simulate some objects that the 17 pre-defined collision shapes don’t handle well. A hemisphere, for instance, might be approximated using HullCollisionShape. But without a large number of vertices, it wouldn’t roll properly on its curved side. (For performance and stability, a HullCollisionShape shouldn’t have more than 100 vertices.)

Sample code is provided here.

CustomConvex
A couple caveats:

  • only convex shapes (no indented shapes, nor shapes with holes)
  • performance is expected to be poorer than the standard shapes (which are implemented in native code)

If specific custom shapes prove popular, they can be re-implemented in native code for a future Minie release. So one might regard custom shapes as a prototyping tool.

17 Likes

Another great step forward for Minie! Thank you @sgold for all your work.

3 Likes