Question by 
               ThePotatoMeister · Jul 08, 2016 at 09:40 AM · 
                floating  
              
 
              Please Help with this problem
Hello i have this script to make a object to move it up and down, but is stuck and i cannot move it. im making a unity 2d game and i want to create a object which is following me and is in air.
     public float amplitude;          //Set in Inspector 
 public float speed;                  //Set in Inspector 
 private float tempVal;
 private Vector2 tempPos;
 
 void Start () 
 {
     tempVal = transform.position.y;
 }
 
 void Update () 
 {        
     tempPos.y = tempVal + amplitude * Mathf.Sin(speed * Time.time);
     transform.position = tempPos;
 }
               Comment
              
 
               
              why you don't use vector3 for tempPos. trangsform.position is a vecter3
when i remove this commands in my script the second character is following the principal character, but when i add the commands is stuck to the edge of the map. why?
Your answer
 
 
              koobas.hobune.stream
koobas.hobune.stream 
                       
                
                       
			     
			 
                