Hi guys, I don't know if this question was already posted or not, I googled it and I found nothing....
I'm trying to do a very simple thing. Make a game object move from point A to point B in a smooth animation, using C#.
I used: transform.Translate(), Vector3.Slerp() and Vector3.SmoothDamp(), but the result is always the same, I even tried to do it this way:
void Update()
{
Vector3 temp = this.transform.position;
temp.y += 0.2f;
this.transform.position = temp;
}
But, the result stills the same....
I want to move the gameObject from (x,0,z) to (x,10,z), but no matter what I do, it never achieves whole results, it stops at 10.01 or 10.2 it never stops in 10. I tried with deltaTime, fixedDeltaTime and smoothDeltaTime, tried do it inside Update and FixedUpdate but it never reaches the exact 10 for y axis.... But if I use increments of a unit like :
y += 1;
Then it works, it achieves 10, but it's way too fast, it doesn't generates a smooth "animation"....
Can anybody here help me understand why does it happens?
↧