CAR GO WROOOOOOM
This commit is contained in:
@@ -4,15 +4,24 @@ using UnityEngine;
|
||||
|
||||
public class CarController : MonoBehaviour
|
||||
{
|
||||
// Start is called before the first frame update
|
||||
void Start()
|
||||
{
|
||||
|
||||
}
|
||||
public WheelCollider frontLeftWheel, frontRightWheel;
|
||||
public WheelCollider rearLeftWheel, rearRightWheel;
|
||||
|
||||
public float motorForce = 10000000f;
|
||||
public float steeringAngle = 30f;
|
||||
|
||||
// Update is called once per frame
|
||||
void Update()
|
||||
{
|
||||
|
||||
// Motor input
|
||||
float motorInput = Input.GetAxis("Vertical");
|
||||
frontLeftWheel.motorTorque = motorInput * motorForce;
|
||||
frontRightWheel.motorTorque = motorInput * motorForce;
|
||||
|
||||
// Steering input
|
||||
float steeringInput = Input.GetAxis("Horizontal");
|
||||
frontLeftWheel.steerAngle = steeringInput * steeringAngle;
|
||||
frontRightWheel.steerAngle = steeringInput * steeringAngle;
|
||||
|
||||
// Move camera
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user