Camera shaking off while cheat movement
This commit is contained in:
@@ -78,6 +78,7 @@ void PlayerController::updateControls(float delta){
|
|||||||
Player* player = level->player;
|
Player* player = level->player;
|
||||||
Camera* camera = player->camera;
|
Camera* camera = player->camera;
|
||||||
Hitbox* hitbox = player->hitbox;
|
Hitbox* hitbox = player->hitbox;
|
||||||
|
bool cameraShaking = camSettings.shaking;
|
||||||
|
|
||||||
bool crouch = input.shift && hitbox->grounded && !input.sprint;
|
bool crouch = input.shift && hitbox->grounded && !input.sprint;
|
||||||
float speed = player->speed;
|
float speed = player->speed;
|
||||||
@@ -87,6 +88,7 @@ void PlayerController::updateControls(float delta){
|
|||||||
}
|
}
|
||||||
if (input.cheat){
|
if (input.cheat){
|
||||||
speed *= CHEAT_SPEED_MUL;
|
speed *= CHEAT_SPEED_MUL;
|
||||||
|
cameraShaking = false;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (crouch) {
|
if (crouch) {
|
||||||
@@ -131,7 +133,7 @@ void PlayerController::updateControls(float delta){
|
|||||||
|
|
||||||
cameraOffset = vec3(0.0f, 0.7f, 0.0f);
|
cameraOffset = vec3(0.0f, 0.7f, 0.0f);
|
||||||
|
|
||||||
if (camSettings.shaking) {
|
if (cameraShaking) {
|
||||||
player->interpVel = player->interpVel * (1.0f - delta * 5) + hitbox->velocity * delta * 0.1f;
|
player->interpVel = player->interpVel * (1.0f - delta * 5) + hitbox->velocity * delta * 0.1f;
|
||||||
if (hitbox->grounded && player->interpVel.y < 0.0f){
|
if (hitbox->grounded && player->interpVel.y < 0.0f){
|
||||||
player->interpVel.y *= -30.0f;
|
player->interpVel.y *= -30.0f;
|
||||||
|
|||||||
Reference in New Issue
Block a user