- Home /
How to transform PC controls to Touchscreen controls
So here is the moving forward script for PC:
wheelRR.motorTorque = maxTorque * Input.GetAxis("Vertical");
wheelRL.motorTorque = maxTorque * Input.GetAxis("Vertical");
And the touchscreen (Android) button:
...
if (touch.phase == TouchPhase.Stationary && gasButton.HitTest (touch.position)) {
//how should i type the moving forward script here to work?
}
why do i need this? because i have a lot of scripts for carcontrol, but they work on PC, how to make them for Android? example: http://s3.postimg.org/wd35m2bwz/screenshot_1306.png
how to make all this for Android?
Answer by haim96 · Feb 22, 2014 at 07:33 PM
http://docs.unity3d.com/Documentation/ScriptReference/Input.GetAxis.html as you can see from the documentation Input.GetAxis is passing float between -1 to 1. so calculate this value from your touch location and pass it to the wheelRR.motorTorque with variable.
do you mean something like this?
var motorInputTouch : int = 0;
if not, how should i do
awesome! :) post the final results so others will find this answer more useful. thanks!
Your answer
Follow this Question
Related Questions
Android Input 1 Answer
Make an Object follow your touch 0 Answers
Problem with Android Keyboard/TextField 1 Answer
Android Controls Help! 2 Answers