translate nicely between two vector3

53

translate nicely between two vector3 -

public class LinearTrasnformation : MonoBehaviour {

    public GameObject cube1, cube2;

    // Use this for initialization
    void Start () {
        //cube1.transform.position = new Vector3 (cube1.transform.position.x,cube1.transform.position.y,cube1.transform.position.z);
    }

    // Update is called once per frame
    void Update () { 
        if(Input.GetKey(KeyCode.UpArrow)){
            cube1.transform.position = Vector3.Lerp (cube2.transform.position,cube1.transform.position,0.5f*Time.deltaTime);
        }
    }
}

Comments

Submit
0 Comments