I am working on a simple game. Right now I am working on moving a cube from one position to another. I am randomly generating a position and I want the cube to move there smoothly. Over time, I want it to move faster.
I have looked into Vector3.MoveTowards and Vector3.Lerp but it still not working. The cube still jumps around a lot and does not gradually move to the new position.
Please post your code so we can help you correct it. MoveTowards and Lerp should both create a smoothly moving object, provided it's done in a loop of some sort (Update or Coroutine).
ā iwaldropMy code is: > Vector3 startm = new Vector3(px - > 0.5f, 0.5f, py - 0.5f); Vector3 finm = new Vector3(cx - 0.5f, 0.5f, cy - 0.5f); Player.transform.position = Vector3.MoveTowards (startm, finm, > Time.deltaTime);
ā Gupi