Search
 
SCRIPT & CODE EXAMPLE
 
CODE EXAMPLE FOR CSHARP

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);
        }
    }
}
Source by stackoverflow.com #
 
PREVIOUS NEXT
Tagged: #translate #nicely
ADD COMMENT
Topic
Name
3+2 =