Skip to content

Commit

Permalink
Movement speed fix
Browse files Browse the repository at this point in the history
  • Loading branch information
MihailRis committed Nov 12, 2023
1 parent 6b5e840 commit c2f130c
Showing 1 changed file with 6 additions and 2 deletions.
8 changes: 6 additions & 2 deletions src/objects/player_control.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -86,6 +86,12 @@ void PlayerController::updateControls(float delta){
speed *= CHEAT_SPEED_MUL;
}

if (crouch) {
speed *= CROUCH_SPEED_MUL;
} else if (input.sprint) {
speed *= RUN_SPEED_MUL;
}

vec3 dir(0,0,0);
if (input.moveForward){
dir.x += camera->dir.x;
Expand Down Expand Up @@ -151,11 +157,9 @@ void PlayerController::updateControls(float delta){
float dt = min(1.0f, delta * ZOOM_SPEED);
float zoomValue = 1.0f;
if (crouch){
speed *= CROUCH_SPEED_MUL;
cameraOffset += CROUCH_SHIFT_Y;
zoomValue = CROUCH_ZOOM;
} else if (input.sprint){
speed *= RUN_SPEED_MUL;
zoomValue = RUN_ZOOM;
}
if (input.zoom)
Expand Down

0 comments on commit c2f130c

Please sign in to comment.