Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

jMonkeyEngine: BetterCharacterControl always bouncing

I create 2 Spartials and set one as RigidBodyControl, second as BetterCharacterControl. Both are boxes of sizes = (10f, 1f, 10f) and (0.5f,0.5f,0.5f).

 floor = createFloor();
 CollisionShape sceneShape = CollisionShapeFactory.createMeshShape(floor);
 landscape = new RigidBodyControl(sceneShape, 0);
 floor.addControl(landscape);
 rootNode.attachChild(floor);

 character = createCharacter();
 player = new BetterCharacterControl(1F,1F,0.01f); 
 character.addControl(player);
 rootNode.attachChild(character);

 bulletAppState.getPhysicsSpace().add(landscape);
 bulletAppState.getPhysicsSpace().add(character); 
 landscape.setPhysicsLocation(new Vector3f(0,-4,5));
 player.warp(new Vector3f(0,0,0));

Now if i run it ... the character just bounces on the floor and i don't know why. If i use the standard CharacterControl it works, though. I'am aware that the character box doesn't match the shape but that shouldn't be the problem i guess.

Thanks in advance!

like image 445
EMP Avatar asked Aug 05 '26 10:08

EMP


1 Answers

Did you try and turn on debugging?

bulletAppState = new BulletAppState();
bulletAppState.setThreadingType(BulletAppState.ThreadingType.PARALLEL);
stateManager.attach(bulletAppState);
bulletAppState.setDebugEnabled(true);

Using debugging could help you see the collision shapes.

like image 197
Niklas Rosencrantz Avatar answered Aug 07 '26 02:08

Niklas Rosencrantz



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!