So, I've got a tank with 7 wheels either side.
I wan't to get as close to a 0 degree turning radius as possible.
The code I've got right now works to make the vehicle move forwards, and then backwards.
How can I go about setting it up so that :
pressing "a" key alone puts the left wheels into reverse and right wheels into forwards
pressing "d" key alone puts the right wheels into reverse and left wheels into forwards
pressing "w" and "a" keys stops applying force to the left wheels
pressing "w" and "d" keys stops applying force to the right wheels
pressing "s" and "a" keys stops applying force to the left wheels
pressing "s" and "d" keys stops applying force to the right wheels
Here is the code I've got :
void Update () {
float v = Input.GetAxis ("Vertical") * MotorForce;
float h = Input.GetAxis ("Horizontal") * SteerForce;
WheelL1.motorTorque = v;
WheelL2.motorTorque = v;
WheelL3.motorTorque = v;
WheelL4.motorTorque = v;
WheelL5.motorTorque = v;
WheelL6.motorTorque = v;
WheelL7.motorTorque = v;
WheelR1.motorTorque = v;
WheelR2.motorTorque = v;
WheelR3.motorTorque = v;
WheelR4.motorTorque = v;
WheelR5.motorTorque = v;
WheelR6.motorTorque = v;
WheelR7.motorTorque = v;
}
I know this may not be the best way to set a tank up (relying on multiple wheel colliders instead of using physics based track pieces), but I am way to new to Unity to go about setting that up.
Thanks for any help
↧