Hello, im trying to make a game where you have a car that is automatically going straight and you can control the directions. It is moving forward very slow, i dont know why. Here is the code
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
public class WheelController : MonoBehaviour
{
[SerializeField] WheelCollider frontRight;
[SerializeField] WheelCollider frontLeft;
[SerializeField] WheelCollider backRight;
[SerializeField] WheelCollider backLeft;
public float acceleration = 500f;
public float breakingForce = 300f;
public float maxTurnAngle = 15f;
public Rigidbody rb;
public float forwardSpeed = 100f;
private float currentAcceleration = 0f;
private float currentBreakForce = 0f;
private float currentTurnAngle = 0f;
private void FixedUpdate()
{
// currentAcceleration = acceleration * Input.GetAxis("Vertical");
// if (Input.GetKey(KeyCode.Space))
// currentBreakForce = breakingForce;
// else
// currentBreakForce = 0f;
rb.AddForce(0, 0, forwardSpeed * Time.deltaTime);
frontRight.motorTorque = forwardSpeed * 100 * Time.deltaTime;
frontLeft.motorTorque = forwardSpeed * 100 * Time.deltaTime;
frontRight.brakeTorque = currentBreakForce;
frontLeft.brakeTorque = currentBreakForce;
backRight.brakeTorque = currentBreakForce;
backLeft.brakeTorque = currentBreakForce;
currentTurnAngle = maxTurnAngle * Input.GetAxis("Horizontal");
frontLeft.steerAngle = currentTurnAngle;
frontRight.steerAngle = currentTurnAngle;
}
}