Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    text
    copied!<p>Try .Lerp, it runs as a coroutine interpolating a value over some amount of time <em>Vector3.Lerp(Vector3 start, Vector3 end, float time)</em></p> <p>See documentation <a href="http://docs.unity3d.com/Documentation/ScriptReference/Vector3.Lerp.html" rel="nofollow">here</a> </p> <p>This should give you a rough idea of whats going on</p> <pre><code>Vector3 Distance = End - Start; // this will return the difference this.transform.position += Distance/time.deltatime * Movetime // this divides the Distance equal to the time.deltatime.. (Use Movetime to make the movement take more or less then 1 second </code></pre> <p>IE: If the Distance is 1x.1y.1z, and time.deltatime is .1 and Movetime is 1.... you get a movement of .1xyz per tick, taking 1 second to reach the end point</p> <p><em>FYI: transform.Translate works as a fancy .position +=, for this purpose you can use them interchangeably</em></p> <p><strong>EDIT</strong> Here are a few solutions </p> <p>Easy :: </p> <pre><code>Vector3 amountToMove = new Vector3(0,1,0); // Vector3.up is short hand for (0,1,0) if you want to use that instead if (Input.GetButtonDown ("VerticalFwd")) { transform.position = Vector3.Lerp(transform.position ,transform.position + amountToMove, 1); } </code></pre> <p>Hard and probably unnecessary :: </p> <p>Write a Coroutine that does a kind of Linear interpolation for your specific application <a href="http://docs.unity3d.com/Documentation/Manual/Coroutines.html" rel="nofollow">See documentation here</a></p>
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload