Oto ”spine” bone casts IllegalStateException on 1st collision with BombControl

Hi!

I aim to Oto “spine” bone, while it is in Character mode, when it becomes a Ragdoll, I think at 1st collision, I get this exception, every time. Any other bone I aim, dont give this exception.

[patch]

SEVERE: Uncaught exception thrown in Thread[LWJGL Renderer Thread,5,main]

java.lang.IllegalStateException: User control must be on bone to allow user transforms

at com.jme3.animation.Bone.setUserTransformsWorld(Bone.java:373)

at com.jme3.bullet.control.KinematicRagdollControl.update(KinematicRagdollControl.java:207)

at com.jme3.scene.Spatial.runControlUpdate(Spatial.java:494)

at com.jme3.scene.Spatial.updateLogicalState(Spatial.java:612)

at com.jme3.scene.Node.updateLogicalState(Node.java:151)

at com.jme3.scene.Node.updateLogicalState(Node.java:158)

at com.jme3.scene.Node.updateLogicalState(Node.java:158)

at com.jme3.scene.Node.updateLogicalState(Node.java:158)

at com.jme3.app.SimpleApplication.update(SimpleApplication.java:249)

at com.jme3.system.lwjgl.LwjglAbstractDisplay.runLoop(LwjglAbstractDisplay.java:143)

at com.jme3.system.lwjgl.LwjglDisplay.runLoop(LwjglDisplay.java:171)

at com.jme3.system.lwjgl.LwjglAbstractDisplay.run(LwjglAbstractDisplay.java:217)

at java.lang.Thread.run(Thread.java:636)

Save took 0.844 seconds

[/patch]



EDIT: this happens in the latest svn, it didnt happened before.

mhh strange, I’ll check that tonight

I can’t reproduce the issue, could you give me some test case please?

I think I just messed my project :D, I am trying to re-write what is too confuse/notClear… and… I will have to restore a backup lol :D…

.

When I recover it, I will try to prepare a test case, the problem is that I have too much scrambled code to filter and make it simple :confused:

.

Just to drop something, if it can be useful, I would like to describe what I am doing, may be I am doing something I should not do right now.

.

I transformed Oto in a ragdoll with this code:

[patch]

protected void setupRagdoll() {

MyKinematicRagdollControl ragdoll = getRagdoll();

ragdoll.addBoneName("spine");

ragdoll.addBoneName("hip.right");

ragdoll.addBoneName("hip.left");

ragdoll.addBoneName("spinehigh");

ragdoll.addBoneName("leg.right");

ragdoll.addBoneName("leg.left");

ragdoll.addBoneName("uparm.right");

ragdoll.addBoneName("uparm.left");

ragdoll.addBoneName("head");

ragdoll.addBoneName("foot.right");

ragdoll.addBoneName("foot.left");

ragdoll.addBoneName("arm.right");

ragdoll.addBoneName("arm.left");

ragdoll.addBoneName("hand.right");

ragdoll.addBoneName("hand.left");

}

[/patch]

As I remember I extracted the bones from the xml.

.

Another thing I do is that, to the controlled entity, I have two simultaneous objects that I enable and disable accordingly:

[patch]model.addControl(character);

model.addControl(ragdoll);[/patch]

.

If the entity is alive, I enable the character control, otherwise I disable it and enable the ragdoll control, as I found no way to move the kinematic (not on ragdoll mode) around.

.

But, I think, may be I should not be doing this?

.

When the projectile hits the character, I disable it and enable the ragdoll. But I think I can be messing things up this way?

The moment I disable the character, I do this also:

[patch] if(ragdoll.isEnabled())

ragdoll.setRagdollMode();[/patch]

So the projectile promptly transfers a collision to ragdoll and make it fall; otherwise the ragdoll would stay stand up, and only fall if I shot another projectile.

you mean you can’t move the character when it’s in Kinematic mode? do you use setLocalTranslation or something else?

Hi!

.

I just understood what was wrong.

When I had to enable the ragdoll, I did ragdoll.setRagdollMode(); but when I had to disable the ragdoll, I didnt do ragdoll.setKinematicMode(); now, with the code below, it is working perfectly! :smiley:

[patch] if(ragdoll.isEnabled())

ragdoll.setRagdollMode(); //this activated the ragdoll just when it is enabled

else

ragdoll.setKinematicMode();

[/patch]



EDIT: @nehon, I just saw that tip is in your answer, thx! :smiley:

Glad it’s working :wink:



Btw I fixed some issues when the ragdolled model is attached to a parent Node, you should update to last SVN revision.

And as always your feedback is much appreciated :wink: