I am having problems getting the BetterCharacterControl to work. My player object is bouncing up and down as though it is on a trampoline… I cannot find a way to adjust the rate of the jumping either. Quite problematic.
[java]
DataHandler.players.attachChild(new Node(DataHandler.playersData.get(playerIndex).id + “”));
DataHandler.player.playerNode = (Node) DataHandler.players.getChild(“Player”);
Spatial player = assetManager.loadModel(“Models/basic_man/basic_man.j3o”);
DataHandler.player.playerPhysics = new BetterCharacterControl(0.5f, 1.5f, 10f);
DataHandler.player.playerPhysics.setGravity(new Vector3f(0f, -9.81f, 0f));
DataHandler.player.playerPhysics.setJumpForce(new Vector3f(0f, 100f, 0f));
DataHandler.player.playerNode.addControl(DataHandler.player.playerPhysics);
DataHandler.physics.getPhysicsSpace().add(DataHandler.player.playerPhysics);
Material playerMat = new Material(assetManager, “Common/MatDefs/Light/Lighting.j3md”);
playerMat.setBoolean(“UseMaterialColors”, true);
ColorRGBA c = ColorRGBA.randomColor();
playerMat.setColor(“Ambient”, c);
playerMat.setColor(“Diffuse”, c);
player.setMaterial(playerMat);
DataHandler.player.playerNode.attachChild(player);[/java]
If you mean that the player is bouncing all the time when walking on an irregular ground, then, yes, it’s “normal”. Actually, this has been discussed a lot of time here, and it’s a problem of momentum. The best thing i can say to you know is too look for my messages here about the bettercharactercontrol.
For a “short” fix : use the charactercontrol instead of the bettercharactercontrol. If this solve your problems, then you must know that you’ll maybe have a lot of other problems.
It is actually a 5x5x0.25 obj model. I do not understand why it would cause problems. Almost all of the game I am building will consist of similar object. Is there any solution?
A test case is a self-contained example in one class that you can post here that shows the problem outside of your application so we can have a look at it.
I am having the exact same issue. My terrain has MeshCollisionShape rigid body physics with restitution of 0, my character uses BetterCharacterControl and its rigidbody has a restitution of 0, but my character just bounces all over the map like its on a trampoline. If JME3 needs any improvement, it is definitely in the CharacterControl area. Sure, I could dig through documentation and take college classes in programming game physics, but the purpose of an engine is to make it easier. I too am going to have to roll my own character physics
@admazzola said:
I am having the exact same issue. My terrain has MeshCollisionShape rigid body physics with restitution of 0, my character uses BetterCharacterControl and its rigidbody has a restitution of 0, but my character just bounces all over the map like its on a trampoline. If JME3 needs any improvement, it is definitely in the CharacterControl area. Sure, I could dig through documentation and take college classes in programming game physics, but the purpose of an engine is to make it easier. I too am going to have to roll my own character physics :(
Or you just make the triangles of the terrain smaller than the character.
I know that has been said, but that is such an odd requirement. Other engines don’t enforce such requirements, do they? My terrain is composed of optimized voxels. I actually went into the PrePhysicsTick functions of BetterCharacterControl and changed it so it does not remember/use previous velocity and now things are looking a bit better; my character doesn’t fly around like a space ship anymore. Still kinda bouncy though.
@admazzola said:
Other engines don't enforce such requirements, do they?
I don't know, if they use bullet they surely will, too.
@admazzola said:
I actually went into the PrePhysicsTick functions of BetterCharacterControl and changed it so it does not remember/use previous velocity and now things are looking a bit better; my character doesn't fly around like a space ship anymore. Still kinda bouncy though.
Sounds like you are doing something very strange if your character flies around like a spaceship..