- Home /
Question by
Rangr · Jul 16, 2016 at 05:59 AM ·
c#movementtransformtime.deltatimeanimationcurve
Time.deltaTime Too Variable
I'm writing a code to have a GameObject follow an animation curve along a path. When I made the curve, I must have had something printing to console every frame because now I have nothing printing to console and it's too fast, but if I start having it print every frame it works fine. I'm very confused. Is there a more reliable way to do this? Code below.
Thanks.
void movement()
{
if (health > 0)
{
Vector3 newPos = transform.localPosition;
newPos.x += x.Evaluate (timer) / speed;
newPos.y += y.Evaluate (timer) / speed;
transform.localPosition = newPos;
timer += Time.deltaTime / speed;
}
}
Comment
Your answer
Follow this Question
Related Questions
Making a bubble level (not a game but work tool) 1 Answer
Dashing through enemies, but not walls. 1 Answer
Is there a way to make a movement pattern using AnimationCurves? 0 Answers
Simultaneously moving GameObjects using C# script. 3 Answers
how do i slowly translate a object to a other objects position 2 Answers