Very bouncy betterCharachterControl

My BetterCharachterControl is very, very, very bouncy. I need it to be much less bouncy. In fact, I’d prefer it if it barely bounced at all.

Here is my code, I’m not sure why it’s behaving this way, and I want it to stop.

BetterCharacterControl player = new BetterCharacterControl(5, 5, 150);
        
        //set up visual display of player
        playerNode = new Node();
            Sphere playerMesh = new Sphere(20, 20, 5);
            Geometry playerGeom = new Geometry("player", playerMesh);
            Material playerMat = new Material(assetManager, "Common/MatDefs/Misc/Unshaded.j3md");
            playerMat.setColor("Color", ColorRGBA.Blue);
            playerGeom.setMaterial(playerMat);
            playerNode.attachChild(playerGeom);
            rootNode.attachChild(playerNode);
            
        playerNode.addControl(player);
        player.warp(new Vector3f(0, 15, 0));
        physics.getPhysicsSpace().add(player);

I have already tried increasing the mass of the character control to ridiculous levels, as well as multiplying it’s gravity significantly.

ATM, It’s only colliding with a flat plane.

Any ideas?

On an unrelated note, where did the forum search function go? I can’t find it, and I’m sure someone else has had this problem before.

Thanks.

@ulfgur said: ATM, It's only colliding with a flat plane.

Can you show us? People say this and then it turns out they are colliding with a giant plane mesh that they made in Blender that is just two ginormous triangles instead of properly split into smaller triangles.

Imgur

I was not aware that surfaces need breaking down for physics to behave properly. I’m currently using collision shapes generated from geometries generated from a Box. Is that broken down enough?

Apparently physics collisions will work better if you have more/smaller triangles. Which makes sense if you think about how the rate of error gets stretched over a long span.

If you actually only want a flat surface (and an infite one wont make problems)
try to use the planeshape class directly,
-> it’s a matehematical representation of a plan, so faster
-> it wont have errors, because it can be calcualted exactly.

@Empire Phoenix said: If you actually only want a flat surface (and an infite one wont make problems) try to use the planeshape class directly, -> it's a matehematical representation of a plan, so faster -> it wont have errors, because it can be calcualted exactly.

Like this?

CollisionShape sceneShape = (CollisionShape) new PlaneCollisionShape(new Plane());
        RigidBodyControl landscape = new RigidBodyControl(sceneShape, 0);
        level.addControl(landscape);
        physics.getPhysicsSpace().add(level);

Now the character falls through the floor. In physics debug mode, it shows nothing where the plane should be.


Plane plane = new Plane();
plane.setOriginNormal(new Vector3f(0, 0.25f, 0), Vector3f.UNIT_Y);
floorGeometry.addControl(new RigidBodyControl(new PlaneCollisionShape(plane), 0));

edit: you dont need casting it to parent class here (also you never needs to cast to interface)


CollisionShape sceneShape = new PlaneCollisionShape(new Plane());

Thanks! Worked like a charm!

(the casting was an artifact of other stuff I tried. Oops. :p)