fix: camera while aiming is now locked to weapon shoulder

main
Sara 2025-01-06 17:07:14 +01:00
parent 5705d5a4c6
commit f9350c24fd
1 changed files with 3 additions and 1 deletions

View File

@ -100,6 +100,8 @@ void Player::_on_dir_horizontal(gd::Ref<gd::InputEvent>, float value) {
void Player::_on_dir_vertical(gd::Ref<gd::InputEvent>, float value) {
this->input_directions.y = value;
this->anim_tree->set_aim_weapon(value <= AIM_INPUT_THRESHOLD);
if(value < AIM_INPUT_THRESHOLD)
this->camera->set_shoulder(true);
this->anim_tree->set_is_walking(value > WALK_INPUT_THRESHOLD);
}
@ -120,7 +122,7 @@ void Player::_on_run(gd::Ref<gd::InputEvent> event, float) {
}
void Player::_on_switch_shoulder(gd::Ref<gd::InputEvent> event, float) {
if(event->is_pressed())
if(event->is_pressed() && !this->anim_tree->get_aim_weapon())
this->camera->set_shoulder(!this->camera->is_weapon_shoulder());
}