[SOLVED] BetterCharacterControl and Ice ground

I want to make an ice floor which the player could slip on it. The floor code is as follow:

control = new RigidBodyControl(new BoxCollisionShape(new Vector3f(.5f, .5f, .5f)), 0);

The player has a capsule collision shape and its mass is 70. There is no slipping effect when moving on the ice but when I tried to put a -1 friction for the ice (I know that this is an illegal value) there is a little wrong slipping effect. I tried to change the mass of the floor with zero friction and it was slipping and colliding with the player like an ice block. So how could I make an ice floor that has a zero mass and the player could slip on it?

I have another question:
How could I remove any z-axis physical movement from the BetterCharacterControl and from RigidBodyControl? I want a 2D like physics.

1 Like

Regarding your first question: Perhaps you’re not seeing slippage because (a) the RigidBodyControl is in kinematic mode or (b) the rigid body is damped. Please check those settings.

1 Like

It’s not kinematic I think. It’s a BetterCharacterControl with its default settings, but I have no idea about dumping. Could you give me a resource :grin:.
Thanks very much for your response

1 Like

What’s the value of betterCharacterControl.getRigidBody().getLinearDamping()? If this value is positive, try lowering it to 0.

1 Like

Thanks @sgold the default dumping was 0.9. The first problem solved now :slight_smile: Thanks.

1 Like

For 2-D physics there are doubtless better solutions than Bullet. However, I don’t know of any that are supported in jMonkeyEngine.

The first thing to try would be to add a PhysicsTickListener object to the physics space, and in its physicsTick() method do something like:

   Vector3f tmpV = new Vector3f();
   for (PhysicsCharacter character : space.getCharacterList()) {
        tmpV.z = 0f;
        tmpV.z = 0f;
   for (PhysicsRigidBody rigid : space.getRigidBodyList()) {
        tmpV.z = 0f;
        tmpV.z = 0f;
1 Like

For purely 2D physics, my guess is that it won’t take you much time to integrate dyn4j with JME. What you will gain is an exponential reduction in complexity and also never having to worry about constantly reclamping your Z, making sure your stuff doesn’t rotate wrong, etc…

If you have no experience with such things then maybe bullet is better “out of the box”.


This worked :slight_smile: thanks for your time. I have tried to stop it with setting z in the walk direction to zero and forgot the internal rigid body completely

I didn’t think that I can use a 2D physics engine with JME :sweat_smile:. This is a good idea I will think about it thanks very much.

1 Like

Others have done it. I’ve even done it. It’s not too bad.


Actually the BCC has all that physicsTick shebang built in with easy to override methods handling all the damping and force applying for the character. I think I put all that info in the javadoc :wink:


wow, its Normen :smiley: you alife!

I found an easier solution to this problem.
Bullet offers a vector factor for linear and angular movements that the velocity will be multiplied with it. We can put Z as zero for linear velocity and zero as an angular factor for producing a 2D like movements for characters.

rigidBody.setLinearFactor(new Vector3f(1, 1, 0));
1 Like

It seems a better solution than bullet. However, I found a plugin for it to JME but it doesn’t have a doc. I wonder if dyn4j could be added to the engine in the future so it could have formal documentation and support :slight_smile: .