//Make it impossible to flip the car:
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
public class Antiroll : MonoBehaviour
{
public WheelCollider WheelRL;
public WheelCollider WheelRR;
public WheelCollider WheelFL;
public WheelCollider WheelFR;
public float AntiRoll = 500f;
public Rigidbody car;
void Update()
{
if (WheelRL.isGrounded)
car.AddForceAtPosition(-WheelRL.transform.up * AntiRoll, WheelRL.transform.position);
if (WheelRR.isGrounded)
car.AddForceAtPosition(-WheelRR.transform.up * AntiRoll, WheelRR.transform.position);
if (WheelFL.isGrounded)
car.AddForceAtPosition(-WheelFL.transform.up * AntiRoll, WheelFL.transform.position);
if (WheelFR.isGrounded)
car.AddForceAtPosition(-WheelFR.transform.up * AntiRoll, WheelFR.transform.position);
}
}