Need help with BetterCharacterControl and collision response

i have a small problem and could use some help please.

i have this set up when moving forwards: walkingDirection.addLocal(modelForwardDir.mult(vspd * tpf * thrust));

vspd is a constant speed, and thrust is 0f to 5.0f increments of 0.2f when hitting the ‘forward’ key

when i hit a wall, i want to bounce off and i try this: walkingDirection.addLocal(modelForwardDir.negate().multLocal(vspd * tpf * thrust));

it tends to stick to the wall for a second and then bounce back, or gets stuck to the wall if I’m going to fast. The thrust reduces down to 0f when the up key isn’t pressed.

Thanks. (NOTE: I already tried the hovertank example, but when i hit a wall the tank turns sideways, upside down, etc.) I keep hitting a metaphor for a wall myself with this.

You can try this control. http://hub.jmonkeyengine.org/forum/topic/simplecharactercontrol-contribution/

What collision shape does the character have? The tutorial recommends a capsule shape.

Also, tpf is likely to be a small value, which probably will make the bounce increment quite small.

I have this as a setup:

[java]
player = (Node) assetManager.loadModel(“Models/tank/tank.j3o”);
player.setLocalTranslation(new Vector3f(5, 5, -50));
player.addControl(new RigidBodyControl(5f));

    rootNode.attachChild(player);

    CapsuleCollisionShape capsuleShape = new CapsuleCollisionShape(1.5f, 1f, 1);
    physicsCharacter = new BetterCharacterControl(3.8f, 15f, 15f);
    player.addControl(physicsCharacter);
    getPhysicsSpace().add(physicsCharacter);

    bulletAppState.getPhysicsSpace().add(player);
    physicsCharacter.setJumpForce(new Vector3f(0, 5, 0)); 
    physicsCharacter.setGravity(new Vector3f(0, -5, 0));[/java]

I think your issue may be that you are using walking direction to simulate physics restitution.

…thus when you ‘change direction’ you have to overcome forward momentum before you see reverse movement. It’s just a guess, though.

If that’s the case then I’m not entirely sure why you are using a physics engine if you don’t really want physics collision and restitution. 50% of a physics engine is collision detection and 50% of a physics engine is contact resolution. The “movement” part is immeasurably small in comparison and can be written in three or four lines of code in the simple case.

In the hovering tank example, when i move forwards my model flips on the side or at an angle and still moves forwards. Using the physicshovercontrol.