Hello, so here’s my script for geared car on phone. I wonder why i am not getting any reaction when i try to press the up texture button. Am i even close to understand how to put axises in to button.
It’d be awesome if you can find me the answer!!
var enginePower=150.0;
var up : GUITexture;
var Magni : float;
private var axisH: float = 0;
private var axisV: float = 0;
function InputGetAxis(axis: String): float {
var v = Input.GetAxis(axis);
if (Mathf.Abs(v) > 0.005) return v;
if (axis=="Horizontal") return axisH;
if (axis=="Vertical") return axisV;
}
function Start(){
axisV = axisH = 0;
}
function Update () {
for (var touch : Touch in Input.touches){
if(touch.phase == TouchPhase.Stationary && up.HitTest (touch.position)){
if (Magni >= 0){
axisH = 1 * enginePower * Time.deltaTime * 600.0;
}
if (Magni > 50){
axisH = 1 * enginePower * Time.deltaTime * 250.0;
}
if (Magni > 100){
axisH = 1 * enginePower * Time.deltaTime * 100.0;
}
if (Magni > 110){
axisH = 1 * enginePower * Time.deltaTime * 80.0;
}
if (Magni > 130){
axisH= 1 * enginePower * Time.deltaTime * 30.0;
}
}
}
}