Node/ragdoll/material problem

in my search at my ragdoll/ physics problem I’ve created this class:


  • To change this template, choose Tools | Templates
  • and open the template in the editor.


    package org.mvd.jme3.models.ragdoll;

    import com.jme3.asset.AssetManager;

    import com.jme3.bullet.PhysicsSpace;

    import com.jme3.bullet.collision.shapes.CapsuleCollisionShape;

    import com.jme3.bullet.joints.PhysicsConeJoint;

    import com.jme3.bullet.joints.PhysicsJoint;

    import com.jme3.bullet.nodes.PhysicsNode;

    import com.jme3.math.Vector3f;

    import com.jme3.scene.Node;


  • @author maarten


    public class simpleRagdoll extends Node{

    private PhysicsNode shoulders;

    private AssetManager assetManager;

    public simpleRagdoll(){




    public simpleRagdoll(String name){




    private void createRagDoll() {

    shoulders = createLimb(0.2f, 1.0f, new Vector3f( 0.00f, 1.5f, 0), true);

    PhysicsNode uArmL = createLimb(0.2f, 0.5f, new Vector3f(-0.75f, 0.8f, 0), false);

    PhysicsNode uArmR = createLimb(0.2f, 0.5f, new Vector3f( 0.75f, 0.8f, 0), false);

    PhysicsNode lArmL = createLimb(0.2f, 0.5f, new Vector3f(-0.75f,-0.2f, 0), false);

    PhysicsNode lArmR = createLimb(0.2f, 0.5f, new Vector3f( 0.75f,-0.2f, 0), false);

    PhysicsNode body = createLimb(0.2f, 1.0f, new Vector3f( 0.00f, 0.5f, 0), false);

    PhysicsNode hips = createLimb(0.2f, 0.5f, new Vector3f( 0.00f,-0.5f, 0), true);

    PhysicsNode uLegL = createLimb(0.2f, 0.5f, new Vector3f(-0.25f,-1.2f, 0), false);

    PhysicsNode uLegR = createLimb(0.2f, 0.5f, new Vector3f( 0.25f,-1.2f, 0), false);

    PhysicsNode lLegL = createLimb(0.2f, 0.5f, new Vector3f(-0.25f,-2.2f, 0), false);

    PhysicsNode lLegR = createLimb(0.2f, 0.5f, new Vector3f( 0.25f,-2.2f, 0), false);

    join(body, shoulders, new Vector3f(0f, 1.4f, 0));

    join(body, hips, new Vector3f(0f, -0.5f, 0));

    join(uArmL, shoulders, new Vector3f(-0.75f, 1.4f, 0));

    join(uArmR, shoulders, new Vector3f(0.75f, 1.4f, 0));

    join(uArmL, lArmL, new Vector3f(-0.75f, .4f, 0));

    join(uArmR, lArmR, new Vector3f(0.75f, .4f, 0));

    join(uLegL, hips, new Vector3f(-.25f, -0.5f, 0));

    join(uLegR, hips, new Vector3f(.25f, -0.5f, 0));

    join(uLegL, lLegL, new Vector3f(-.25f, -1.7f, 0));

    join(uLegR, lLegR, new Vector3f(.25f, -1.7f, 0));













    private PhysicsNode createLimb(float width, float height, Vector3f location, boolean rotate) {

    int axis = rotate ? PhysicsSpace.AXIS_X : PhysicsSpace.AXIS_Y;

    CapsuleCollisionShape shape = new CapsuleCollisionShape(width, height, axis);

    PhysicsNode node = new PhysicsNode(shape);


    return node;


    private PhysicsJoint join(PhysicsNode A, PhysicsNode B, Vector3f connectionPoint) {

    Vector3f pivotA = A.worldToLocal(connectionPoint, new Vector3f());

    Vector3f pivotB = B.worldToLocal(connectionPoint, new Vector3f());

    PhysicsConeJoint joint = new PhysicsConeJoint(A, B, pivotA, pivotB);

    joint.setLimit(1f, 1f, 0);

    return joint;




    (the important code is just stolen from the tutorials :p)

    now when I call the code with this:

    [java]Material mat1 = new Material(assetManager, “Common/MatDefs/Misc/SolidColor.j3md”);

    mat1.setColor(“m_Color”, ColorRGBA.Blue);

    ragdoll=new simpleRagdoll();


    ragdoll.setLocalTranslation(new Vector3f(0, 20, 0));




    it does nothing.

    I can’t see my pretty ragdoll and when I keep my camera at that ragdoll’s location it seems that physics on it doesn’t work.

    So there should be something wrong with my code: it is not blue and it’s physics aren’t working.

    someone that can spot my stupid mistake?

whatever, I’ve solved it :slight_smile:

but now I have another question: I have represented the bones of my ragdoll as simple cilinders, they are however not filled at the top/bottom.

how can I fill/close my cilinder?

If you could go a bit into how you actually solved the issue this topic would be of greater help to users searching the forum for help with their queries.

I’ve set the material for my ragdoll but the ragdoll consists of physicsNodes.

of course a physicNode stays invisible after applying a material on it.

So I created a geometry ( a box) and made a physicsnode around that box.

if you then apply a material on the physicsNode the material will be applied to the box and your character will get visible.

And if you do that you can see that physics do get applied