После торможение wheele collider застревает
Почему после полной остановки "машины", когда я снова задаю AddForce, "машина" отказывается ехать?
Ссылка на видео тык
Я думаю, что проблема в Wheele Collider, поиграл со значениями, но бестолку.
Хавнокод
using System.Collections;
using System.Collections.Generic;
using UnityEditorInternal;
using UnityEngine;
[RequireComponent(typeof(Rigidbody))]
public class StriderController: MonoBehaviour
{
private Rigidbody rb;
[SerializeField]
[Range(-200.0f, 500.0f)]
private float _speed = 0;
[SerializeField]
private int _braking = 750;
[SerializeField]
private bool _brake = false;
private void Awake()
{
rb = GetComponent<Rigidbody>();
}
void FixedUpdate()
{
VelocityController(_speed, _braking);
}
private void VelocityController(float speed, int braking)
{
if (_brake)
{
rb.AddForce(-rb.velocity * braking);
_speed = 0;
}
if (speed != 0)
{
rb.AddForce(transform.forward * 100 * speed);
}
}
}