Tasharen Entertainment Forum
Support => NGUI 3 Support => Topic started by: lixobags on July 28, 2014, 11:42:02 PM
-
Hello,
New to Unity here, Im currently trying to adjust a script i purchased and was hoping someone can help me out here.
The current script contains "InputGetAxis" where if you press up or down it moves the car forward and backwards.
***************************************************************************************************************
void FixedUpdate()
{
if (!Enabled)
return;
#region UserInput
float vertical = Input.GetAxis("Vertical"); //Forward & Backward drive input
float horizontal = Input.GetAxis("Horizontal"); //Angular velocity control input
float space = Input.GetAxis("Jump"); //break control input
#endregion
if (vertical > 0)
CurrentEngineAcceleration = Acceleration * vertical;
else CurrentEngineAcceleration = (Acceleration * vertical) * BackwardAccelerationFactor;
*****************************************************************************************************************
What i would like to know is, how do you go about allocating an NGUI button to the work as Input Manager "Vertical" can you do this or no?
Thanks for the help if you can
-
I'm sorry, but this is support forum for NGUI, and I'm not sure how any of the code you posted relates to NGUI. I can help with NGUI's code, and answer questions, but I can't write code to make some third party code work for you.
If you are trying to replace InputGetAxis stuff with NGUI buttons, then just make buttons and inside their OnPress(bool isPressed) functions record whether the button is pressed or not.