Formula for acceleration to reach max velocity

Hi!

I tried to get a formula for calculating max velocity of a rigidbody, but after couple of days of trial and error, where I tried to apply some physics formulas to find my values I got nothing because I was unable to figure out how unity calculates all of this.

I got some results from this formula found on the forums(without gravity and friction):

maxVelocity = ((force.magnitude / drag ) - fixedDeltaTime * force.magnitude )/ mass;

and force is just:

Vector3.forward * mass * acceleration;

Right now I need to set the acceleration to achieve max speed, but can’t quite get the formula right for this. Is it even possible? I have tried transforming this formula, but I failed :confused: (the shame!)

This is for a rigidbody without gravity and any friction.

some code:

public Rigidbody r;
public float acceleration = 1f;
public float currentForwardSpeed ;
private Transform _t;
private float force;

void Start()
{
  _t = GetComponent<Transform>();
  acceleration = ???????
  force = _t.forward * r.mass * acceleration;
}

void FixedUpdate)
{
  currentForwardSpeed = _transform.InverseTransformDirection(_rigidbody.velocity).z;
  if(Input.GetKey(KeyCode.W))
  {
    float maxVelocity = ((force.magnitude / r.drag ) - fixedDeltaTime * force.magnitude )/ r.mass;
  }
}

See my answer over here