- Home /
Question by
NinjaRubberBand · Nov 28, 2013 at 05:24 PM ·
vector3moveup
My gameobject moves up wrong
I made a gameobject, and when you click on that gameobject it moves a bit up. and when you then click on it again ti moves a bit up again. And so on. But what it does it when it moves, it just go straight up. If it could go up smootlhy it would be nice, but how do i do that? Here is the script that i made: #pragma strict
var speed:int = 5;
function OnMouseDown () { transform.Translate(Vector3(0,speed,0) * Time.deltaTime);
}
Comment
Answer by ziv03 · Nov 28, 2013 at 06:18 PM
Use coroutine: http://docs.unity3d.com/Documentation/ScriptReference/MonoBehaviour.StartCoroutine.html this way you can move it up smoothly.
Your answer
![](https://koobas.hobune.stream/wayback/20220613123016im_/https://answers.unity.com/themes/thub/images/avi.jpg)