Advertisement
gandalfbialy

Untitled

May 31st, 2025
226
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C# 0.91 KB | None | 0 0
  1. using UnityEngine;
  2.  
  3. public class SupportDriveScript : MonoBehaviour
  4. {
  5.     Rigidbody rb;
  6.     float lastTimeChecked;
  7.  
  8.     public float antiRoll = 5000.0f;
  9.  
  10.     void Start()
  11.     {
  12.         rb = GetComponent<Rigidbody>();
  13.     }
  14.  
  15.     void Update()
  16.     {
  17.         if (transform.up.y > 0.5f || rb.linearVelocity.magnitude > 1f)
  18.         {
  19.             lastTimeChecked = Time.time;
  20.         }
  21.  
  22.         if (Time.time > lastTimeChecked + 3f)
  23.         {
  24.             TurnBackCar();
  25.         }
  26.     }
  27.  
  28.     void TurnBackCar()
  29.     {
  30.         transform.position += Vector3.up;
  31.         transform.rotation = Quaternion.LookRotation(transform.forward);
  32.     }
  33.  
  34.     void HoldWheelOnGround(WheelCollider[] wheels)
  35.     {
  36.         WheelHit hit;
  37.         float leftRiding = 1.0f;
  38.         float rightRiding = 1.0f;
  39.  
  40.         bool groundedL = wheels[0].GetGroundHit(out hit);
  41.  
  42.         if (groundedL)
  43.         {
  44.  
  45.         }
  46. }
  47.  
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement