Hello,
[Edited : Post was previously named : Initializing gravity on a PhysicsCharacterNode ]
I’ve found what was wrong with my PhysicsCharacterNode … I didn’t link the correct object to the root Node.
Now I have that :
[java]
bulletAppState = new BulletAppState();
bulletAppState.setThreadingType(BulletAppState.ThreadingType.PARALLEL);
stateManager.attach( bulletAppState );
physicsSpace = bulletAppState.getPhysicsSpace();
…
//Load physicsnodes
for( Iterator<PhysicsCharacterNode> i = playerTeam.getPhysicsNodeList().iterator(); i.hasNext(); )
{
PhysicsCharacterNode node = i.next();
characterNodes.add( node );
rootNode.attachChild( node );
physicsSpace.add( node );
}
[/java]
And my physical node are :
[java]
CharacterAppearance app = character.getAppearance();
//CapsuleCollisionShape capsule = new CapsuleCollisionShape( 1.0f + app.getWidth(), app.getHeight());
BoxCollisionShape capsule = new BoxCollisionShape(new Vector3f( 1.0f, 2.5f, 1.0f));
this.battleChar = new PhysicsCharacterNode(model, capsule, 0.01f);
this.battleChar.setUpAxis(1);
this.battleChar.setGravity(10);
this.battleChar.setFallSpeed(1);
this.battleChar.setJumpSpeed(10);
[/java]
Now my character is correctly displayed but it falls through other physical object
I tried to add a simple plane as the landscape :
[java]
//create land
Box box1 = new Box(Vector3f.ZERO, 50f, 2f, 50f);
Geometry landBox = new Geometry(“Box1”, box1);
Material mat1 = new Material( ViewManager.getAssetManager(), “Common/MatDefs/Misc/SolidColor.j3md”);
mat1.setColor(“m_Color”, ColorRGBA.Green);
landBox.setMaterial(mat1);
PhysicsNode physland = new PhysicsNode(landBox, new BoxCollisionShape(new Vector3f( 50f, 2f, 50f)), 0);
rootNode.attachChild(physland);
physicsSpace.add(physland);
[/java] (retrieved from the post ‘Problem with collisions between player & geometry’ )
But it still go through
Something is missing ?
Ok.
I’ve found where the problem was…
I applied the setLocalTranslation to the initial model and not the the PhysicsCharacterNode …
Sorry for this worthless post.