rigidbody deceleration and Time.deltaTime

I’m using this code to gradually decelerate my player.

    public float DSpeed = .9f;
	//Stop
	if(Input.GetButton("Fire2")){
		rigidbody.velocity = rigidbody.velocity * DSpeed;
		rigidbody.angularVelocity = rigidbody.angularVelocity * DSpeed;
		
	}

It works fine for me, but I’m not sure it will work for all users unless I add Time.deltaTime. When I do this though, it stops the player almost instantly.

DSpeed has to be less than one:

    public float DSpeed = .9f;
	//Stop
	if(Input.GetButton("Fire2")){
		rigidbody.velocity = rigidbody.velocity * DSpeed * Time.deltaTime;
		rigidbody.angularVelocity = rigidbody.angularVelocity * DSpeed * Time.deltaTime;
		
	}

What is the right way to apply Time.deltaTime here or should I just leave it out?

Using Time.deltaTime here is not conceptually correct, but there is a deltaTime issue since you will slow down differently as the frame rate changes. A fix for this problem is to execute the code in FixedUpdate(). Since in FixedUpdate() the frame rate will be constant, it will work the same across all machines/platforms.

The problem when using deltaTime is that it is equal something like 0.02 for 50fps.
Meaning that your velocity is now vel * 0.02 and that is why you almost stop.

What you could do is either to place your deceleration in the FixedUpdate, keeping the input in the update and getting both method to communicate using a boolean.

Or you can try:

float speedMul = 1;
public float changeSpeed;
if(Input.GetButton("Fire2")){
   speedMul -= TimedeltaTime * decreaseSpeed;
   rigidbody.velocity = rigidbody.velocity * DSpeed * speedMul;
}

Modifying changeSpeed will increase or decrease the time it takes to stop your guy.

You can when releasing the button performs the invert effect to produce a gradually increasing speed