Search Unity

Script dont translate!

Discussion in 'Scripting' started by robertseadog, Sep 17, 2005.

  1. robertseadog

    robertseadog

    Joined:
    Jul 23, 2005
    Posts:
    374
    This code will not translate the obj!

    Code (csharp):
    1.  
    2. function Update () {
    3. transform.position = Vector3 (Input.GetAxis ("Horizontal") * Time.deltaTime, 0, Input.GetAxis ("Vertical") * Time.deltaTime);
    4. }
    5.  
    When I play it, the obj I assign it to simply dissapears! Any ideas?

    Thanks!
     
  2. Joachim_Ante

    Joachim_Ante

    Unity Technologies

    Joined:
    Mar 16, 2005
    Posts:
    5,203
    You are setting the position and not changing it incrementelly.
    Basically you are moving your object close the the zero point.

    Hit frame selected on the object after it happens to see where it ends up.

    You probably want to use transform.Translate instead.