The issue is the ragdoll character is fixed in sky and not falling to floor. After hitting bullet the mesh fall down but skeleton is still fixed in its position. See the code below and attached images. please let me know what wrong in code or 3D model.
Code:-
bulletAppState = new BulletAppState();
bulletAppState.setEnabled(true);
stateManager.attach(bulletAppState);
Sphere bullet = new Sphere(32, 32, 1.0f, true, false);
bullet.setTextureMode(Sphere.TextureMode.Projected);
bulletCollisionShape = new SphereCollisionShape(1.0f);
PhysicsTestHelper.createPhysicsTestWorld(rootNode, assetManager, bulletAppState.getPhysicsSpace());
model = (Node) assetManager.loadModel("Models/batman_animated/batman_animated.j3o");
//Chest-ogremesh
Node controlNode = (Node) findSpatial(model, "Geometry-ogremesh").clone();
AnimControl control = controlNode.getControl(AnimControl.class);
SkeletonDebugger skeletonDebug = new SkeletonDebugger("SkeletonControle", control.getSkeleton());
Material mat2 = new Material(getAssetManager(), "Common/MatDefs/Misc/Unshaded.j3md");
mat2.getAdditionalRenderState().setWireframe(false);
mat2.setColor("Color", ColorRGBA.Green);
mat2.getAdditionalRenderState().setDepthTest(false);
skeletonDebug.setMaterial(mat2);
skeletonDebug.setLocalTranslation(model.getLocalTranslation());
//Note: PhysicsRagdollControl is still TODO, constructor will change
ragdoll = new KinematicRagdollControl(10.0f);
setupBiped(ragdoll, control.getSkeleton());
ragdoll.addCollisionListener(this);
controlNode.addControl(ragdoll);
bulletAppState.getPhysicsSpace().add(ragdoll);
rootNode.attachChild(controlNode);
rootNode.attachChild(skeletonDebug);
You need to remove this line : rootNode.attachChild(skeletonDebug);
and add this line : bulletAppState.setDebugEnabled(true);//to enable bone and physic debug view
You may look at TestBoneRagdoll.java at JmeTests project .
To create JmeTests project in JME SDK : File β NewProject β JME3 Tests
PS: Recommend to set weightThreshold to 0.5f in this line ragdoll = new KinematicRagdollControl(10.0f);
setting to 10 cause application to crash when switching to native-bullet physic.
I referred the same test class as you mentioned. also I tried weightThreshold to 0.5f but the same result. My basic problem is not how to show bone and physic debug view.
The problem is shown in screen no. 2 and 3. When I start the application, the human character is loaded and set as shown screen 2, it seems there is no effect of physics on it, the character is fixed on the same position until I hit it. When I hit it with bullet, it falls down in ragdoll mode as shown in screen 3 but the skeleton is still fixed in its position.
What I want it when application starts, the character should fall down to floor as a character (not as ragdoll mode). the skeleton should move along with character.
I am not sure what is wrong with this code or 3D model.
it is because you are adding skeletonDebug to your scene. Just remove this line rootNode.attachChild(skeletonDebug);
Actually It is moving along with your character but you just do not see it. To get sure that your skeleton is moving with your character you should enable debug view. and it is done by adding this bulletAppState.setDebugEnabled(true);