Changing distance with Vector3.Distance

I’m working on making a script in which certain nodes have to be a certain distance apart (doesn’t matter how they are apart as long as they are apart by the set distance) and I was hoping we could use something like Vector3.Distance( ) to do this. For example:

distance = Vector3.Distance(transform.position, target.position);
distance = 40;

Well by establishing distance as 40, it would make it 40 (I’m not sure what the measure is) apart. I know this isn’t the way it works but what can I do that would serve that purpose?

  • First, get the start pos : start = transform.position I guess ?
  • Second, get the normalized direction : dir = target.position - transform.position
  • Finally, assemble : target.position = start + dir * 40;