Hi,gays.
Sorry for my English (Russian)
A task:
Write a script for driving, without using a wheel collider, only rigidbody. But you need to add the ability to drift.
There have been several attempts, but in one of them I have not been able to implement the drift itself, but in another one the car is almost not moving in the forward direction.
attempt - 1
//MoveCar
Vector3 movement = transform.forward * Time.deltaTime * speed * 1f;
rb.MovePosition(movement + transform.position);
rb.isKinematic = true;
// TurnCar
float angel = Input.GetAxisRaw("Horizontal") * turnSpeed * Time.deltaTime;
Quaternion rot = Quaternion.Euler(0, angel, 0);
rb.MoveRotation(rot * transform.rotation);
attempt - 2
if (CheekSpeed(rb.velocity , MaxSpeed))
{
rb.AddRelativeForce(speed * Vector3.forward);
}
float angel = Input.GetAxisRaw("Horizontal") * turnSpeed ;
rb.AddRelativeTorque(Vector3.up * angel , ForceMode.Impulse);
Tell me what I’m doing wrong.
Thanks!