new car control

This commit is contained in:
magn9775
2024-04-05 10:54:52 +02:00
parent 28332bbd01
commit d0d4635387
4 changed files with 303 additions and 14 deletions

View File

@@ -9,7 +9,6 @@ public class carcontrolv2 : MonoBehaviour
public float maxSpeed = 20;
public float steeringRange = 30;
public float steeringRangeAtMaxSpeed = 10;
public float centreOfGravityOffset = -1f;
WheelControl[] wheels;
Rigidbody rigidBody;
@@ -19,9 +18,6 @@ public class carcontrolv2 : MonoBehaviour
{
rigidBody = GetComponent<Rigidbody>();
// Adjust center of mass vertically, to help prevent the car from rolling
rigidBody.centerOfMass += Vector3.up * centreOfGravityOffset;
// Find all child GameObjects that have the WheelControl script attached
wheels = GetComponentsInChildren<WheelControl>();
}