fix: camera while aiming is now locked to weapon shoulder
parent
5705d5a4c6
commit
f9350c24fd
|
@ -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) {
|
void Player::_on_dir_vertical(gd::Ref<gd::InputEvent>, float value) {
|
||||||
this->input_directions.y = value;
|
this->input_directions.y = value;
|
||||||
this->anim_tree->set_aim_weapon(value <= AIM_INPUT_THRESHOLD);
|
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);
|
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) {
|
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());
|
this->camera->set_shoulder(!this->camera->is_weapon_shoulder());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue