Transform player to RaycastHit.point depending on speed float

I’m working on a Third Person cover system shooter and currently I’m working on the cover functionality.
_
I have two scripts: a character controller script and a cover detection script.
_
I have code on my cover detection script that detects cover with a raycast and creates a raycasthit.point at the point of collision with the collider. I also have a float on the same script called coverMoveSpeed that I’d like to multiply against time.delta so the player doesn’t instantly snap to the cover, instead I’d like it to smoothly move there depending on the coverMoveSpeed float.
_
In my head I thought it would be as simple as this:

bool coverKey = Input.GetButton("Cover");

        if (coverKey & coverMovement.canCover)
        {

            transform.position = coverMovement.hit.point + coverMoveSpeed * Time.deltaTime;
        }
        else
        {
            
        }

Here’s my implementation

//on my cover detect script

public float coverMoveSpeed = 3.0f;

//Here's my character controller script

bool coverKey = Input.GetButton("Cover");

        if (coverKey & coverMovement.canCover)
        {

            transform.position = coverMovement.hit.point;
        }
        else
        {
            
        }

_
However it doesnt compile, I know I’m close so I’m turning to the unity forums once again!

_
beep beep “Paging Dr. Stark” @LCStark

transform.position = coverMovement.hit.point + coverMoveSpeed * Time.deltaTime;

This will not compile - you are trying to add two different data types: coverMovement.hit.point which is a Vector3, and coverMoveSpeed * Time.deltaTime, which is a float.

You want to move your transform from its current position ( transform.position) to the point where you found the collision with the cover ( coverMovement.hit.point ? ). You can use Vector3.MoveTowards function to do that. (Vector3.MoveTowards documentation)

As you can see in the example given in the Scripting API documentation, it’s pretty simple:

void Update() {
    // The step size is equal to speed times frame time.
    float step = speed * Time.deltaTime;

    // Move our position a step closer to the target.
    transform.position = Vector3.MoveTowards(transform.position, target.position, step);
}