Hi guys, I tried setting up my car.
However, whenever I hit play and the car touches the mesh collider or a box collider, it goes absolutely crazy and I cant figure out why.
heres the code:
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
public class CarController : MonoBehaviour
{
public WheelCollider[] wheels = new WheelCollider[4];
public float torque = 200;
private void Start()
{
}
private void FixedUpdate()
{
if (Input.GetKey(KeyCode.W))
{
for (int i = 0; i < wheels.Length; i++)
wheels[i].motorTorque = torque; ;
} else
{
for (int i = 0; i < wheels.Length; i++)
wheels[i].motorTorque = 0;
}
}
}