Minie v3.0

Version 3.0.0 of the Minie Physics Library was released today. It’s available from both GitHub and JCenter.

For details, see the release page at GitHub. For more details, see the release log.

I plan to delve into the main changes tomorrow, after I tie up some loose ends. Watch this Forum topic!

3.0.0 is now the recommended release for all users.


Seven cool, new features of Minie v3.0.0:

  1. a mechanism to apply bone rotations (from an AnimClip , for instance) to linked bones in dynamic mode

It’s long been possible to drive a DynamicAnimControl character using canned animations. Prior to Minie v3, however, the animation-driven links had to be in kinematic mode, which caused issues because physics joints work best when all their end bodies are dynamic.

With v3, it’s possible to use canned animations to drive links that are in dynamic mode. The resulting animations are imperfect, mainly because they ignore the root bone and any translation of the linked bones. There may also be some slight lag. However, the new mechanism works much better with ragdoll effects and inverse kinematics than the old one did.

The crucial method is BoneLink.setDynamic(Vector3f, Quaternion). To use this feature, you’ll have to extract bone rotations from canned animations; I suggest using the Wes Library for that.

To see this feature in action, run the TestDac application and press the “6” key on the main keyboard.

  1. a mechanism to ignore collisions between physics links that aren’t directly joined

The default for DynamicAnimControl has always been to ignore collisions between directly connected physics links, such as the left femur and left tibia in a humanoid character. But collisions could still occur between links that weren’t directly connected. Such collision impaired flexibility for some models and sometimes caused characters to jiggle violently.

Minie v3 adds an “ignored hops” parameter to DAC. The default value of 1 mimics the old behavior. Setting it to 2 causes Minie to ignore collisions between physics links separated by up to 2 joints. Higher settings are possible, but then you might see limbs poking through one another. A nice side effect is that the more collisions you ignore, the less CPU is consumed by physics.

The crucial method is DacConfiguration.setIgnoredHops(int).

This feature isn’t used in any open-source examples yet. However, I’m using ignoredHops = 2 in my closed-source game, and can attest that it works great.

  1. a fixToWorld() method to lock a PhysicsLink into position
  2. an adjustable pinToWorld() method

DynamicAnimControl implements inverse kinematics using controllers and physics joints. To constrain a character’s left foot to be at a particular location, you add an IK joint to its physics link. If the joint constrains both location and orientation, I call that a “fix”. If it constrains location but not orientation, I call that a “pin”.

The pinToWorld() method in Minie v1/v2 was unaffected by ragdoll mode and didn’t allow the pin to move. The new pinToWorld() allows you to alter the location of the pin at any time, simply by updating the joint’s translation limits. Also, you can configure it to be automatically disabled (or not) when the DAC goes into ragdoll mode.

Minie v3.0 also adds a fixToWorld() method. Like the new pinToWorld(), it is ragdoll-aware and allows the location (but not the orientation) to be updated.

DynamicAnimControl.pinToWorld() is used in TestDac to pin the character’s left femur when you press the “9” key on the main keyboard. It’s also used in RopeDemo.

DynamicAnimControl.fixToWorld() is used in TestDac to fix the character’s torso when you press the “7” key on the main keyboard.

  1. a NewHinge subclass inspired by Bullet’s btHinge2Constraint

Minie includes many special-purpose constraints that are included in Bullet, all of which can be emulated using New6Dof. NewHinge is a new special-purpose constraint intended for a front wheel of a motor vehicle. It rotates freely on one axis, with limited rotation (steering) and limited translation (suspension) on another axis.

Although inspired by Bullet’s btHinge2Constraint, NewHinge is actually implemented using New6Dof, not btHinge2Contraint, so its API is a superset of New6Dof.

To see NewHinge in action, check out the HelloNewHinge app.

  1. a factory method to construct a satisfied, double-ended New6Dof constraint using physics-space coordinates

New6Dof is a very versatile physics constraint. As often happens, versatility leads to complexity. It’s very tricky to create double-ended New6Dof using the constructor, because you have to express the desired constraint in terms of 3 coordinate systems: those of the A body, the B body, and the “frame” of the constraint itself.

Minie v3.0 adds a newInstance() factory method that allows you to specify the frame in physics-space coordinates (which are usually identical to “world” or “scene” coordinates). By assuming that the constraint is satisfied at creation, it computes the necessary coordinate transforms for you. See the javadoc.

No open-source examples yet, but I expect to use this a lot going forward!

  1. a CcdFilter class to select rigid bodies with CCD active

For debugging issues with continuous collision detection (CCD), I found it helpful to enable debug visualization, but only for the bodies with CCD active. So I wrote this debug filter to select those bodies, by testing the linear velocity of each dynamic rigid body against its CCD motion threshold.

You’ll find it in the jme3utilities.minie package. Enjoy!