- Home /
Reset Input.GetAxis Back to 0
Good'day, I'm having trouble finding a way resetting the Axis back to 0, I'm using Input.GetAxis ("Mouse X") to get it, is there any way to set this? any help would be greatly appreciated, thanks! - Jabez
I think we need more context. If you don't move the mouse, Input.GetAxis("$$anonymous$$ouse X") should return 0.0.
Yes sorry. That's true, It returns to 0 on the computer, but on the android it has weird effect, I'm using it to control a ball left & right but when i release my finger off the screen & touch again it doesn't reset it. I think i'll just use the mouse position ins$$anonymous$$d of the axis. this is my script // Update is called once per frame void update () { h = Input.GetAxis("$$anonymous$$ouse X") ; rigidbody.AddForce (Vector3.right * h); } }
Thanks I shall look into it, i was trying to take the lazy way but as you know, the lazy way isn't the best way. The very first script on the script reference should do the trick with some tweaking. https://docs.unity3d.com/Documentation/ScriptReference/Input.GetTouch.html
The lazy way is usually good for quick prototyping, but yeah, not the best way. :)
Your answer
Follow this Question
Related Questions
New Input axis with Numpad Keys 2 Answers
Help In Making a SphereCast for 3D Tire! Working RayCast Script included! 0 Answers
Creating an input manager that supports axis 0 Answers
How to get an axis without defining it in the InputManager 0 Answers
Problems with joystick / controller axes being 1/-1 "way too often" 1 Answer