DynamicAnimControl
is intended to replace KinematicRagdollControl
for ragdoll animations, kinematic character physics, and inverse kinematics. I introduced it last month with a demo video:
(October 2018) Monthly WIP & Screenshot thread - #35 by sgold
While the API is still subject to change, it’s now stable enough for serious testing. It’s part of the open-source Minie library, which is part of the Jme3-utilities project:
GitHub - stephengold/jme3-utilities: Reusable code and assets for jMonkeyEngine games (code has New BSD license)
GitHub - stephengold/Minie: Integrate Bullet Physics and V-HACD into jMonkeyEngine projects. (code has New BSD license)
The latest Minie release is v0.4.4, which depends on 2 other Jme3-utilities libraries and also on v3.2.1 of jMonkeyEngine. You can find the JARs on GitHub at:
Release Minie library v0.4.4 · stephengold/jme3-utilities · GitHub
and on Bintray at:
Version Minie/0.4.4 - stephengold
If you use Gradle, your build script should include:
repositories {
maven { url 'https://dl.bintray.com/stephengold/jme3utilities' }
}
dependencies {
compile 'jme3utilities:Minie:0.4.4'
}
Minie replaces both the jme3-bullet
library and the jme3-bullet-native
library, so DO NOT include those libraries as dependencies. It also conflicts with the jme3-jbullet
library.
The TestDac
application suggests how DynamicAnimControl
might be used:
https://github.com/stephengold/jme3-utilities/blob/master/tests/src/main/java/jme3utilities/minie/test/TestDac.java
Minie/TestDac.java at master · stephengold/Minie · GitHub
After instantiating a control, configure it using the methods defined by ConfigDynamicControl
, particularly its link()
method. (In TestDac
, configuration is done by custom subclasses such as ElephantControl
.) Linking a bone means it will have its own rigid body in the physics ragdoll. Any bones not explicitly linked will be managed, either by the BoneLink
of their nearest linked ancestor, or (if no ancestor is linked) by a catchall link called the torso. When linking a bone, you also specify its mass and range of motion.
After the control is configured, add it to the same model Spatial
that has the SkeletonControl
. This instantiates the links and the ragdoll, including rigid bodies and joints. The control automatically generates hull collision shapes that incorporate every vertex in the model’s animated meshes. If there isn’t at least one vertex for the torso and also for each linked bone, this step will fail.
After adding the control to the model Spatial
, add the control to your PhysicsSpace
.
As mentioned in the demo video, each link can be independently set to dynamic or kinematic mode. You can have bone animations playing on specific bones (kinematic mode) while other bones are animated by physics collisions and forces (dynamic mode).
There’s also support for attachment nodes, freezing links, and even amputating limbs.
Configuring the range of motion for each BoneLink
may be the hardest part of using DynamicAnimControl
. Whereas KinematicRagdollControl
attempted to provide a single preset for all humanoid models, DynamicAnimControl
will likely require custom tuning for each model. Note that DynamicAnimControl
specifies ranges of motion in “bone user coordinates” (relative to bind pose). The sample presets (ElephantControl
, JamieControl
, SinbadControl
and so on) were created by hand using the TuneDac
application to visualize the X, Y, and Z axes of each bone. I’m currently working to integrate DynamicAnimControl
into the Maud
editor. It may eventually be possible to autoconfigure ranges of motion based on bone-animation data.
I hope people will find DynamicAnimControl
both useful and fun. I welcome questions and constructive feedback.