I switched to BetterCharacterControl and my main character gets this problem. It slides and goes to a complete halt when facing a slope or a minor obstacles. How can I prevent the sliding and stopping when the ground is uneven? I read that there was something like setMaxSlope for CharacterControl, is there something like it also for BetterCharacterControl and is it that method that I should be using?
The code that creates my main character is
[java]private void createNinja() {
ninjaNode = (Node) assetManager
.loadModel(“Models/Ninja/Ninja.mesh.xml”);
ninjaNode.setShadowMode(RenderQueue.ShadowMode.CastAndReceive);
ninjaNode.setLocalScale(0.06f);
ninjaNode.setLocalTranslation(new Vector3f(55, 3.3f, -60));
ninjaControl = new BetterCharacterControl(2, 4, 0.5f);
ninjaControl.setJumpForce(new Vector3f(6, 6, 6));
ninjaNode.addControl(ninjaControl);
rootNode.attachChild(ninjaNode);
bulletAppState.getPhysicsSpace().add(ninjaControl);
getPhysicsSpace().add(ninjaControl);
animationControl = ninjaNode.getControl(AnimControl.class);
animationChannel = animationControl.createChannel();
}[/java]
That code is inside the createcharacters method that gets called my the initialization of the app:
[java] private void createCharacters() {
createNinja();
createGoblin();
createJamie();
createOto();
createMonster();
}
@Override
public void simpleInitApp() {
this.setDisplayStatView(false);
bulletAppState = new BulletAppState();
bulletAppState.setThreadingType(BulletAppState.ThreadingType.PARALLEL);
stateManager.attach(bulletAppState);
bulletAppState.setDebugEnabled(false);
setupKeys();
DirectionalLight dl = new DirectionalLight();
dl.setColor(ColorRGBA.White.clone().multLocal(2));
dl.setDirection(new Vector3f(-1, -1, -1).normalize());
rootNode.addLight(dl);
AmbientLight am = new AmbientLight();
am.setColor(ColorRGBA.White.mult(2));
rootNode.addLight(am);
if (useHttp) {
assetManager
.registerLocator(
"http://jmonkeyengine.googlecode.com/files/quake3level.zip",
HttpZipLocator.class);
} else {
assetManager.registerLocator("quake3level.zip", ZipLocator.class);
}
// create the geometry and attach it
MaterialList matList = (MaterialList) assetManager
.loadAsset("Scene.material");
OgreMeshKey key = new OgreMeshKey("main.meshxml", matList);
gameLevel = (Node) assetManager.loadAsset(key);
gameLevel.setLocalScale(0.1f);
gameLevel.addControl(new RigidBodyControl(0));
getPhysicsSpace().addAll(gameLevel);
rootNode.attachChild(gameLevel);
getPhysicsSpace().addAll(gameLevel);
createCharacters();
setupAnimationController();
setupChaseCamera();
setupFilter();
}[/java]
How should I resolve my issue?