- Home /
 
Move sphere between start and end on the line
Hi I draw a line with
 Vector2 pos = transform.position;
 Gizmos.DrawLine(Vector2.zero, pos);
 
               I want get this line's vectors as 0-1 so i can draw a sphere and move between start and end on the line with a slider I draw sphere but i don't know how can i move it between start and end on the vector
 Gizmos.DrawLine(Vector2.zero, pos);
 
              
               Comment
              
 
               
               
               Best Answer 
              
 
              Answer by Casiell · Jan 07 at 06:50 PM
For this you need to use Vector2.Lerp. In this method 'a' and 'b' parameters are your start and end respectively. 't' is the normalized value you'll get from a slider.
Thanks
 Vector2 moveSphereRange =  Vector2.Lerp(Vector2.zero, pos, floatRange);
 Gizmos.DrawWireSphere(moveSphereRange, 0.0002f);
 
 Thanks it works 
                 Your answer