Add raw strength value for internal use
This commit is contained in:
parent
10fd107599
commit
195d58be0f
6 changed files with 74 additions and 27 deletions
|
|
@ -326,6 +326,15 @@ float Input::get_action_strength(const StringName &p_action) const {
|
|||
return E->get().strength;
|
||||
}
|
||||
|
||||
float Input::get_action_raw_strength(const StringName &p_action) const {
|
||||
const Map<StringName, Action>::Element *E = action_state.find(p_action);
|
||||
if (!E) {
|
||||
return 0.0f;
|
||||
}
|
||||
|
||||
return E->get().raw_strength;
|
||||
}
|
||||
|
||||
float Input::get_joy_axis(int p_device, int p_axis) const {
|
||||
_THREAD_SAFE_METHOD_
|
||||
int c = _combine_device(p_axis, p_device);
|
||||
|
|
@ -603,10 +612,12 @@ void Input::_parse_input_event_impl(const Ref<InputEvent> &p_event, bool p_is_em
|
|||
action.physics_frame = Engine::get_singleton()->get_physics_frames();
|
||||
action.idle_frame = Engine::get_singleton()->get_idle_frames();
|
||||
action.pressed = p_event->is_action_pressed(E->key());
|
||||
action.strength = 0.f;
|
||||
action.strength = 0.0f;
|
||||
action.raw_strength = 0.0f;
|
||||
action_state[E->key()] = action;
|
||||
}
|
||||
action_state[E->key()].strength = p_event->get_action_strength(E->key());
|
||||
action_state[E->key()].raw_strength = p_event->get_action_raw_strength(E->key());
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue