Moving an object between multiple points.

Hey guys,

How, would I go about smoothly moving a cube between two player objects… lets just make them two spheres for now…

so that it bounces back and forth between them as they move.

I guess more specifically,

  1. how do I follow something smoothly

  2. how do I figure out when I have reached close to the thing I was following

  3. how do I now start following something else

Use iTween :
http://itween.pixelplacement.com/index.php

Use Slerp on the positions.

Subtract their two position vectors and get the magnitude of the result.

If that magnitude is less than the distance you require then switch to the next target in your list or array or whatever.

For info on how to do that look at the unity documentation on Vector3.

hey, thanks a bunch, will look into slerp

I you like to do it comfortable , use iTween , it saved me hours of work. And its free by the way.