hi
when i use deltatime like below, computer repeat command every second and it couse unsmooth movement.
object is jumping.
var translation = Time.deltaTime * 10;
i want to use 1/2 second or smaller time parts.
how can i do that?
Thanx
hi
when i use deltatime like below, computer repeat command every second and it couse unsmooth movement.
object is jumping.
var translation = Time.deltaTime * 10;
i want to use 1/2 second or smaller time parts.
how can i do that?
Thanx
Time.deltaTime gives you the amount of time since the last frame. This is so that you can have the ability to keep things moving at the same pace based on duration of time, rather then frames per second.
There’s two ways I can think to do what you want.
Method 1, Create a timer:
var tmr:float = 0;
var tmrInterval:float = 0.5;
function Update()
{
if(tmr < tmrInterval)
{
tmr += Time.deltaTime;
}else{
tmr -= tmrInterval; //The reason we don't = 0 is so it's more accurate over time.
//the rest of your code to happen every half second here.
}
}
The other way I know is yeild… but I’ve never gotten that to work.