i have a gameobject its moving.
in start
speed = 10f;
dirX = 1;
dirY = 1;
direction = transform.TransformDirection(new Vector3(dirX, dirY, 0));
in update
transform.Translate(direction * Time.deltaTime * speed);
There are three points in game.
While i touch on gameobject it should move to firstpoint.
First point is 10f(distance) away from game object.
and secondpoint is 20f(distance) away from first point.
And third is 50f(distance) away from second point.
I kept all points in a arraylist.
Using lerp i am trying to move from update function.
How make it move with a uniform speed?
This is the code i written in update
Vector3 nPoint = (Vector3)myPoints[index];
this.transform.position = Vector3.Lerp(transform.position, nPoint, 0.4f);
index++
the object is not moving with uniform speed? Do you have any other idea to make it work?