Yes, the Update
loop is ideal for this. There are no special plug-ins required and you can do this with the free version. Basically you move the objects a tiny bit towards their destination each frame. When all those frames run one right after the other, it gives the appearance of smooth movement. A self contained script would look like the one I've created below. Ideally you'd take this as a starting point, and update it to use your own speed and starting point.
//move towards a target at a set speed.
private void MoveTowardsTarget() {
//the speed, in units per second, we want to move towards the target
float speed = 1;
//move towards the center of the world (or where ever you like)
Vector3 targetPosition = new Vector3(0,0,0);
Vector3 currentPosition = this.transform.position;
//first, check to see if we're close enough to the target
if(Vector3.Distance(currentPosition, targetPosition) > .1f) {
Vector3 directionOfTravel = targetPosition - currentPosition;
//now normalize the direction, since we only want the direction information
directionOfTravel.Normalize();
//scale the movement on each axis by the directionOfTravel vector components
this.transform.Translate(
(directionOfTravel.x * speed * Time.deltaTime),
(directionOfTravel.y * speed * Time.deltaTime),
(directionOfTravel.z * speed * Time.deltaTime),
Space.World);
}
}
This code could be anywhere (for now just put it inside the script you're using it from). Tn the script attached to the sphere you want to move, you'd put: MoveTowardsTarget()
in the Update()
function.