I'm wanting to move away from the deprecated "CharacterControl" to the "BetterCharacterControl" for the 3D game I'm messing with in JMonkeyEngine3 Here is the code I have so far for initiating them:
public void initPlayer(){
// We set up collision detection for the player by creating
// a capsule collision shape and a CharacterControl.
CapsuleCollisionShape capsuleShape = new CapsuleCollisionShape(1.5f, 6f, 1);
player = new CharacterControl(capsuleShape, 0.05f);
player.setJumpSpeed(20);
player.setFallSpeed(30);
player.setGravity(30);
player.setPhysicsLocation(new Vector3f(-10, 10, 10));
bulletAppState.getPhysicsSpace().add(player);
}
public void initBetterPlayer(){
CapsuleCollisionShape betterCapsuleShape = new CapsuleCollisionShape(1.5f, 6f, 1);
betterPlayer = new BetterCharacterControl(2f,6f,1f);
// set basic physical properties:
betterPlayer.setJumpForce(new Vector3f(0,5f,0));
betterPlayer.setGravity(new Vector3f(0, 1f ,0));
betterPlayer.warp(new Vector3f(-10, 10, 10));
bulletAppState.getPhysicsSpace().add(betterPlayer);
}
In the initBetterPlayer() i'm also having trouble linking the CapsuleCollisionShape to the betterPlayer.
And here is where I use the location in the simpleUpdate() method:
player.setWalkDirection(walkDirection);
cam.setLocation(player.getPhysicsLocation());
The problem is there is no method like getPhysicsLocation() for BetterCharacterControl it seems, only a protected field called "location".
Any input is greatly appreciated.