Problem with jcar script for android mobile

Hello everybody :smiley:
I have again some problem’s with some scripting :frowning:
So my problem is what i use is (ctrl-j) jcar script .
But i can’t make it so that i want to don’t use the
accelerometer for acclerating and for reverse .
I want instead (accelerometer) to press a certain button (like gas,brake pedal etc…)
But i want to have steering with accelerometer so steering don’t need editing :slight_smile:

using UnityEngine;
using System.Collections;

public class JControlledCar : JCar {
	
	// automatic, if true car shifts automatically up/down
	public bool automatic = true;

	public float shiftDownRPM = 1500.0f; // rpm script will shift gear down
	public float shiftUpRPM = 2700.0f; // rpm script will shift gear up

	void Update() {
		if (Input.GetKeyDown("page up")) {
			ShiftUp();
		}
		if (Input.GetKeyDown("page down")) {
			ShiftDown();
		}
		if (Input.GetKeyDown("g")) {
			automatic = !automatic;
		}
		if (Input.GetKeyDown("t")) {
			switch (wheelDrive) {
				case JWheelType.Front : wheelDrive = JWheelType.All; break;
				case JWheelType.Back : wheelDrive = JWheelType.Front; break;
				case JWheelType.All : wheelDrive = JWheelType.Back; break;
			}
			foreach (WheelData w in wheels) {
				WheelCollider col = w.col;
				col.motorTorque = 0f;
				col.brakeTorque = 0f;
			}
		}
	}

	
	// handle the physics of the engine
	void FixedUpdate () {
		
		float steer = 0; // steering -1.0 .. 1.0
		float accel = 0; // accelerating -1.0 .. 1.0
		bool brake = false; // braking (true is brake)
		
//		if ((checkForActive == null) || checkForActive.active) {
//			// we only look at input when the object we monitor is
//			// active (or we aren't monitoring an object).
//			steer = Input.GetAxis("Horizontal");
//			accel = Input.GetAxis("Vertical");
//			brake = Input.GetButton("Jump");
//		}
		if ((checkForActive == null) || checkForActive.active) {
			// we only look at input when the object we monitor is
			// active (or we aren't monitoring an object).

			// don't know if I guessed the right axi (what's plural for axis?) here
			// now you have to hold the iphone more or less flat and move from there
			// just experiment with it, for really good control you maybe have to look
			// for something more advanced like averaging the samples to get less
			// jitter and stuff.
			steer = -Input.acceleration.y;
			accel = Mathf.Clamp(4f * (-Input.acceleration.z -0.5f), -1f, 1f);
// Debug.Log("v = " + iPhoneInput.acceleration + " accel = " + accel);
			// for brake I only check if there is a touch started or going on
			for (int i = 0; i < Input.touchCount; i++) {
				Touch touch = Input.GetTouch(i);
				if ((touch.phase != TouchPhase.Ended) && (touch.phase != TouchPhase.Ended)) {
					brake = true;
				}
			}
		}
		
		// handle automatic shifting
		if (automatic && (CurrentGear == 1) && (accel < 0.0f)) {
			ShiftDown(); // reverse
		}
		else if (automatic && (CurrentGear == 0) && (accel > 0.0f)) {
			ShiftUp(); // go from reverse to first gear
		}
		else if (automatic && (MotorRPM > shiftUpRPM) && (accel > 0.0f)) {
			ShiftUp(); // shift up
		}
		else if (automatic && (MotorRPM < shiftDownRPM) && (CurrentGear > 1)) {
			ShiftDown(); // shift down
		}
		if (automatic && (CurrentGear == 0)) {
			accel = - accel; // in automatic mode we need to hold arrow down for reverse
		}
		if (brake) {
			accel = -1f;
		}
		
		HandleMotor(steer, accel);
	}
}

I hope that it’s everything is clear .

I really hope that some one can help me :slight_smile:

Hi all, My english little bad, sorry. I have same problem. any body help me.please. because I dont know how can I make for android