- Home /
Enabling input
Here is the code I have at the moment:
if (rotor_Velocity >= 0.54){
Debug.Log ("started");
rotor_Velocity += Input.GetAxis( "Vertical2" ) * 0.001;
}
What I am trying to do is make it so that once the rotor velocity has reached 0.54, my input is enabled. Obviously, the way the code is now, it is only enabled once the velocity is greater than 0.54. I would like it to work under 0.54 as well, but only once it has achieved 0.54. Any help would be greatly appreciated.
Answer by Brock Beaudry · Oct 12, 2013 at 06:12 PM
A quick and easy solution would be to add a bool which is set to true once the desired velocity is achieved. Use it as a conditional check in the if statement.
C# example:
bool inputEnabled = false;
if (rotor_Velocity >= 0.54 || inputEnabled) {
Debug.Log ("started");
inputEnabled = true;
rotor_Velocity += Input.GetAxis( "Vertical2" ) * 0.001;
}
Your answer
![](https://koobas.hobune.stream/wayback/20220613115820im_/https://answers.unity.com/themes/thub/images/avi.jpg)
Follow this Question
Related Questions
Help In Making a SphereCast for 3D Tire! Working RayCast Script included! 0 Answers
Unity not detecting input device in build 0 Answers
I need to make the Camera Quit snapping to center... 1 Answer
Unable to check input action 0 Answers
How to get different Animations when different button combos are pressed 2 Answers