mirror of
https://github.com/godotengine/godot.git
synced 2026-01-05 06:11:29 +03:00
Fix physics tick counter
The counter is now incremented at the start of a physics tick rather than the end.
This commit is contained in:
@@ -506,13 +506,14 @@ void InputDefault::_parse_input_event_impl(const Ref<InputEvent> &p_event, bool
|
||||
|
||||
// If not echo and action pressed state has changed
|
||||
if (!p_event->is_echo() && is_action_pressed(E->key(), false) != p_event->is_action_pressed(E->key())) {
|
||||
// As input may come in part way through a physics tick, the earliest we can react to it is the next physics tick.
|
||||
if (p_event->is_action_pressed(E->key())) {
|
||||
action.pressed = true;
|
||||
action.pressed_physics_frame = Engine::get_singleton()->get_physics_frames();
|
||||
action.pressed_physics_frame = Engine::get_singleton()->get_physics_frames() + 1;
|
||||
action.pressed_idle_frame = Engine::get_singleton()->get_idle_frames();
|
||||
} else {
|
||||
action.pressed = false;
|
||||
action.released_physics_frame = Engine::get_singleton()->get_physics_frames();
|
||||
action.released_physics_frame = Engine::get_singleton()->get_physics_frames() + 1;
|
||||
action.released_idle_frame = Engine::get_singleton()->get_idle_frames();
|
||||
}
|
||||
action.strength = 0.0f;
|
||||
|
||||
Reference in New Issue
Block a user