i want to make a police car follow a player but the curve of the vehicle is very heavy and the movement is still very slow, I wanted it to be a little lighter, like a vehicle driven by a player.
here´s the code
Thanks for helping
using System.Collections;
using System.Collections.Generic;
using System.Collections.Specialized;
using System.Diagnostics;
using System.Reflection.Emit;
using System.Security.Cryptography;
using UnityEngine;
using UnityEngine.AI;
public class viatura : MonoBehaviour
{
float aceleração, ré, curva;
public float ForcaDoMotor, ControleDeCurva, ForçaDoFreio;
public WheelCollider DianteiraDireita, DianteiraEsquerda, TraseiraDireita, TraseiraEsquerda;
public GameObject player;
Transform LocalDoPlayer;
float MaxAnguloDaRoda = 30;
Vector3 Jogador;
// Update is called once per frame
public void start()
{
Jogador = player.transform.position;
}
public void Update()
{
Vector3 ViaturaVector = transform.InverseTransformPoint(player.transform.position);
float angulo = (ViaturaVector.x / ViaturaVector.magnitude) * MaxAnguloDaRoda;
TraseiraDireita.motorTorque = ForcaDoMotor;
TraseiraEsquerda.motorTorque = ForcaDoMotor;
DianteiraDireita.steerAngle = angulo;
DianteiraEsquerda.steerAngle = angulo;
}
}