BetterCharacterControl acts like trampoline?

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.

How about not moving and on completely flat land.

I don’t understand your question

1 Like

Use a higher linear dampening might reduce the bumping, also changing the restitution helps a little.

Make a test case. You’ll probably find the character doesn’t do it there. Then find out whats different in your current code.

Here is a video of the problem…

[video]http://youtu.be/SDmSnpVq2O8[/video]

@tlf30 said: Here is a video of the problem...

Don’t make your “terrain” large boxes, especially not thin ones. Use mesh shapes, planes or heightfield shapes for terrain.

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?

Make a test case.

1 Like
@normen said: Make a test case.

This IS the second try.

@tlf30 said: This IS the second try.

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.

1 Like

Sorry, I should have posted it.

I gave up and am now using a physics engine I wrote when working with lwjgl. It is simpler but does a better job of what I need.

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 :frowning:

@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.

1 Like

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.

Did you try to option “CharacterControl” instead of the bettercharactercontrol ?

Also, can you try to set the restitution for both the terrain and the character to 0 ?

@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..

@normen even TestBetterCharacter.java has such an issue. Something like flickering.
When i put the character on the plane it starts flicker up and down with a constant sequence. Just take a look at the video test:
[video]http://www.youtube.com/watch?v=KG37Pcb9XYM&feature=youtu.be[/video]

Possibly we can do something here? As the flickering has a constant sequence.

@mifth Well, the test also uses a big box mesh with triangles larger than the character. Try walking on the sphere.