Instantiating objects on a ray

One sphere is standing, another is flying with AddForce.
There’s a ray between them. I wonder how to instantiate objects on that ray with a specific distance?

Vector math is your friend. Given the two sphere position vectors movingSphere and stationarySphere…

// get the direction by subtracting, and normalizing so it has a length of 1
Vector3 direction = (movingSphere - stationarySphere).normalized;

// create your objects - this will create 10 of them, but I assume you'll want to do something
// to stop creating them if you reach the moving sphere or something
float separationDistance = 2;  // units of separation
for (int i = 0; i < 10; i++)
{
  float distance = (i + 1) * separationDistance;
  Vector3 objectPosition = stationarySphere + (direction * distance);
  // TODO : instantiate your object at objectPosition
}

Something like that should give you the basic idea. The key is finding a unit vector that points in the right direction, then multiplying it by the distance along the ray to find the new position.