BetterCharacterControl not applying RigidBody at the right Position

So Im new to JME3 and I have a few problems understanding the BetterCharacterControl.

When I try to apply a BetterCharacterControl to a box it always “expands” from the upper part of the box instead of the center. (A picture explains that better:)

I cant find any functions to change the location it gets applied at, I already tried to create a subclass in which I changed the RigidBody to the BoxCollisionShape directly but that seems to somehow screw up the isOnGround Method. Also if I want to use slopes later it would be nice to have the capsule shape.

[java]Box box2 = new Box(10, 15, 10);
player = new Geometry(“Player”, box2);
player.setLocalTranslation(new Vector3f(0, 20, 0));
Material mat = new Material(assetManager,
“Common/MatDefs/Light/Lighting.j3md”);
mat.setBoolean(“UseMaterialColors”, true);
mat.setColor(“Ambient”, ColorRGBA.Blue);
mat.setColor(“Diffuse”, ColorRGBA.Blue);
player.setMaterial(mat);

playerC = new BetterCharacterControl(12, 30, 0);
playerC.setJumpForce(new Vector3f(0, 700, 0));
player.addControl(playerC);

rootNode.attachChild(player);

bulletAppState.getPhysicsSpace().add(playerC);[/java]

On a different note, it seems like I i have to apply a huge vector for the jump force for it to do anything (I didnt change any gravity values)

Im glad for any help

Attach your geometry to a node, move it in the node and attach the PhysicsControl to the node – Or put your geometry center at the bottom of the geometry.

2 Likes

Ahhh I see, thank you that helped a lot