Float Action to Boolean Action (FloatActionToBooleanAction)

mind Mapping

insert image description here

Specific steps

1. Creation of "floating point action"

"Right handle trigger key press" needs to use "Input.UnityInputManager.1DAxisAction" preset body to become FloatAction, the way is to copy the name of the left handle trigger key axis to the AxisName property of 1DAxisAction
insert image description here

2. Creation of "Boolean Action"

The hidden display of the newly created capsule Capsule:
when BoolAction is activated, gameObject.SetActive(false) hides the capsule;
when BoolAction is deactivated, gameObject.SetActive(true) displays the capsule
insert image description here

3. Use "FloatToBoolean.cs" to connect the two actions

FloatAction, when the value changes, calls DoTransform() of FloatToBoolean, as shown in Figure 1.
FloatToBoolean then lets BoolAction "receive" the converted Bool value, as shown in Figure 2.insert image description here
insert image description here

Notice

Positive Bounds "positive value boundary": we can adjust it to 0.8~1, that is, when the trigger button is pressed to the end, the converted Bool value is true
insert image description here

Guess you like

Origin blog.csdn.net/weixin_42935398/article/details/132543627