Character control setWalkDirection() movement speed

If you are doing First person similar to the HelloCollision Tutorial

[java]

@Override

public void simpleUpdate(float tpf) {

Vector3f camDir = cam.getDirection().clone().multLocal(0.6f);

Vector3f camLeft = cam.getLeft().clone().multLocal(0.4f);

walkDirection.set(0, 0, 0);

if (left) { walkDirection.addLocal(camLeft); }

if (right) { walkDirection.addLocal(camLeft.negate()); }

if (up) { walkDirection.addLocal(camDir); }

if (down) { walkDirection.addLocal(camDir.negate()); }

player.setWalkDirection(walkDirection);

cam.setLocation(player.getPhysicsLocation());

}[/java]



then change the 0.6f and 0.4f values

1 Like