Hi everybody,
I create a floor:
[java]
private Geometry createFloor() {
Box box = new Box(5, 2f, 5);
Geometry floor = new Geometry(“Floor”, box);
Material mat = new Material(assetManager, “Common/MatDefs/Misc/Unshaded.j3md”);
mat.setColor(“Color”, ColorRGBA.Gray);
floor.setMaterial(mat);
return floor;
}
[/java]
simpleInit:
[java]
floor = createFloor();
CollisionShape sceneShape = CollisionShapeFactory.createMeshShape(floor);
landscape = new RigidBodyControl( sceneShape,0);
floor.addControl(landscape);
rootNode.attachChild(floor);
landscape.setPhysicsLocation(new Vector3f(0,-4,0));
bulletAppState.getPhysicsSpace().add(landscape);
[/java]
next i create a player:
[java]
character = new Node();
player = new BetterCharacterControl(1f,1f, 0.01f);
character.addControl(player);
rootNode.attachChild(character);
bulletAppState.getPhysicsSpace().add(character);
player.warp(new Vector3f(0,7,0));
[/java]
All i see is the character going up and down … seems like he is not loosing his velocity.
If i use the “common” CharacterControl, it works but if i move it via
[java]
walkDirection.set(0, 0, 0);
if(left){walkDirection.addLocal(speedtpf, 0, 0);}
if(right){walkDirection.addLocal(-speedtpf, 0, 0);}
if(forward){walkDirection.addLocal(0, 0, speedtpf);}
if(backward){walkDirection.addLocal(0, 0, -speedtpf);}
player.setWalkDirection(walkDirection);
[/java]
it clips through the floor.
I’am already really frustrated by this topic and i didn’t find a good solution on the net.
Do you have any idea? Help is really appreciated