Hello.
I’ve followed tutorials but there’s 2 problems I can’t figure out or where to look from here…
- how to use a cylinder instead of capsule? Cylinder would work just fine for my player as surface is flat.
I get this:
java.lang.UnsupportedOperationException: Kinematic character nodes cannot have mesh collision shapes
[java]
player = (Node) assetManager.loadModel(“Models/Oto/Oto.mesh.xml”);
playerBody = new CylinderCollisionShape();
playerControl = new CharacterControl(playerBody, 0);
player.addControl(playerControl);[/java]
From tutorials I would image the CharacterControl creates shape as dynamic by default and cylinder is described as non-mesh… so I don’t get this error message at all.
- since I’m using capsule now, how can I rotate it so it stretches on Z axis? In my game world Z is the up, not Y.I’ve found the setViewDirection(), but that rotates the spatial, not the collision shape.
2.1. Also, shape falls towards -Y, even if I set gravity of the system towards -Z…
[java] bulletAppState = new BulletAppState();
stateManager.attach(bulletAppState);
bulletAppState.getPhysicsSpace().setGravity(Vector3f.UNIT_Z.negate().multLocal(9.81f));
bulletAppState.getPhysicsSpace().enableDebug(assetManager);
player = (Node) assetManager.loadModel(“Models/Oto/Oto.mesh.xml”);
//playerBody = new CylinderCollisionShape();
playerBody = new CapsuleCollisionShape(60f, 140f);
playerControl = new CharacterControl(playerBody, 0);
player.addControl(playerControl);
player.setLocalScale(27f);
player.lookAt(Vector3f.UNIT_Y, Vector3f.UNIT_Z); // this doesn’t apply if I do physics
ControlMovable movable = new ControlMovable(); // where walkDirection is set for movement
movable.setMaxMoveSpeed(300);
player.addControl(movable);
bulletAppState.getPhysicsSpace().add(player);
rootNode.attachChild(player);[/java]
Thank you for your help.