hello to everyone, i am following the physics tutorials,
- is there a way to modify the movement speed of a character control. Because in my game i will have different classes with different movement speeds.
- if not possible, should i use warp(with my own movement formulas) to move my character instead of setWalkDirection().
@tralala said:
hello to everyone, i am following the physics tutorials,
1) is there a way to modify the movement speed of a character control. Because in my game i will have different classes with different movement speeds.
2) if not possible, should i use warp(with my own movement formulas) to move my character instead of setWalkDirection().
I think that you do setMovementSpeed(float speed),
but maybe if you multLocal(float scalar) the movement direction it goes faster/slower. Not sure about that one.
1 Like
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
ok nice idea both,
doing :playerPhysics.setWalkDirection(walkDirection.mult(0.2f));
made it move slower so it works.