float _x, _y;
public float speed = 10.0f;
void FixedUpdate()
{
_x = Input.GetAxis("Horizontal") * Time.fixedDeltaTime * speed;
_y = Input.GetAxis("Vertical") * Time.fixedDeltaTime * speed;
Vector3 v = new Vector3(_x, _y);
print("Скорость движение " + rb.velocity.magnitude);
rb.AddForce(v, ForceMode.Impulse);
if (_x == 0 || _y == 0)
{
rb.velocity = Vector3.zero;
}
else
{
rb.velocity = Vector2.ClampMagnitude(v, 0);
}
}