Speed based on distance

Hi, I try to make an object land on the ground based on distance. I already did this:
distance = Vector3.Distance(target.position, obj.position);
and tried to calculate the rigidbody velocity based on distance the object is from the target(ground).However I got problem with calculating it, could someone help me :confused: Im quit new to vectors.
rb.velocity = distance / Time.deltaTime?? ;

Your first issue is that you don’t just want the distance, you also want the direction to your object so you know what direction to move in. Luckily, this is exactly what a Vector is, it is a mathematical structure that contains both Direction and Magnitude. So lets start by grabbing the Vector between your object and your target. This can be done by subtraction your object’s position from your targets position.

Vector3 toTarget = target.position - obj.position

Now lets lets multiply by a speed factor. This will let you control how fast you want to go based off of how far away you are.

float speedFactor = 2;
toTarget *= speedFactor;

Now you have a vector that represents both the direction you want to travel AND how fast you want to travel, based off of your distance to your target. Now you just need to set your velocity (No need for Time.deltaTime as Velocity is independent of framerate

rb.velocity = toTarget;