can i change this into UI controls ??
var WheelFR : WheelCollider;
var WheelFL : WheelCollider;
var WheelRR : WheelCollider;
var WheelRL : WheelCollider;
var Speed = 10;
var Braking = 20;
var Turning = 20;
function Update ()
{
//This code makes the car go forward
WheelRR.motorTorque = Input.GetAxis("Vertical") * Speed;
WheelRL.motorTorque = Input.GetAxis("Vertical") * Speed;
WheelRR.brakeTorque = 0;
WheelRL.brakeTorque = 0;
//This code makes the car turn
WheelFL.steerAngle = Input.GetAxis("Horizontal") * Turning;
WheelFR.steerAngle = Input.GetAxis("Horizontal") * Turning;
//This code puts brakes on the car
if ( Input.GetKey(KeyCode.Space))
{
WheelRL.brakeTorque = Braking;
WheelRR.brakeTorque = Braking;
}
}
Comment
Your answer
![](https://koobas.hobune.stream/wayback/20220612053316im_/https://answers.unity.com/themes/thub/images/avi.jpg)
Follow this Question
Related Questions
navmesh agent on car rotate problem 0 Answers
How to make rpm increase like this video 0 Answers
How to fix this? C# 1 Answer
Problem in steering with wheelcolliders 0 Answers
Unity 5 Car accident 0 Answers