DynamicAnimControl - No mesh vertices for linked bone

Hi Guys,
When configuring some joints using DynamicAnimControl I’m getting “No mesh vertices for linked bone” exception.
For example when linking “Joint29” of the Ninja model.
Here is the stack trace:

java.lang.IllegalArgumentException: No mesh vertices for linked bone "Joint29".
	at com.jme3.bullet.animation.DacLinks.createBoneLink(DacLinks.java:1522)
	at com.jme3.bullet.animation.DacLinks.createSpatialData(DacLinks.java:872)
	at com.jme3.bullet.control.AbstractPhysicsControl.setSpatial(AbstractPhysicsControl.java:405)
	at com.jme3.scene.Spatial.addControl(Spatial.java:775)
	at com.scenemaxeng.projector.SceneMaxApp$6.run(SceneMaxApp.java:1430)
	at com.jme3.app.LegacyApplication$RunnableWrapper.call(LegacyApplication.java:822)
	at com.jme3.app.AppTask.invoke(AppTask.java:147)
	at com.jme3.app.LegacyApplication.runQueuedTasks(LegacyApplication.java:733)
	at com.jme3.app.LegacyApplication.update(LegacyApplication.java:748)
	at com.jme3.app.SimpleApplication.update(SimpleApplication.java:247)
	at com.jme3.system.lwjgl.LwjglAbstractDisplay.runLoop(LwjglAbstractDisplay.java:151)
	at com.jme3.system.lwjgl.LwjglDisplay.runLoop(LwjglDisplay.java:197)
	at com.jme3.system.lwjgl.LwjglAbstractDisplay.run(LwjglAbstractDisplay.java:232)
	at java.lang.Thread.run(Thread.java:745)

How can I tell if a joint is linkable or not?

1 Like

The number of vertices assigned to an armature joint depends (in a complicated way) on which joints are linked. DacWizard makes this determination using RagUtils.coordsMap().

So @sgold, does it mean that the order of the joint linking is important? If I will link some joints before Joint29 in the Ninja model it will affect the vertices calculations and might allow linking Joint29?

1 Like

The order in which armature joints get linked is not important.

DynamicAnimControl invokes coordsMap() each time the control gets added to a Spatial. At that point, all that linking has been done.

OK so if I will invoke coordsMap() before adding DynamicAnimControl to a spatial I will be able to determine whether or not a given joint is linkable? that’s the way to do it?
And one more question? collision detection happens only for linked joints? I mean If I want to react to a Ninja Left foot colliding with the Zombie so the NinjaLeftFoot joint must be linked in order to get that resolution?

1 Like

Correct. The code in DacWizard should provide a good example:
Minie/Model.java at 9af4630ab7fc3822a08244d69a804237c9408b56 · stephengold/Minie · GitHub

Incorrect. Collision detection is based on collision shapes (not armature joints). Every mesh vertex gets assigned to a physics link, and every physics link produces a collision shape.

Even if “NinjaLeftFoot” is not linked, the mesh vertices it influences will get assigned to some physics link. If the left shin is linked, then they’d probably get assigned to it. If the left shin is not linked but the left thigh is, then they’d probably get assigned there. And so on.

If no armature joints are linked, then all mesh vertices get assigned to the torso. Of course, the torso’s collision shape won’t reflect any bone animations.

1 Like

From my tests I can detect which joints / bones where “involved” in a collision only when I link them. I’m using this information for making important decisions

1 Like