Move Object with Lerp – Unity3D (C#)
You can use Lerp function to move an object automatically. You just need start and end points. Object moves from start to end in time. You can assign start point and end point manually in script or with mouse click. These points may be another objects positions too. Just assign these points, attach this script to an object and let it move.
1 2 3 4 5 6 7 |
private float time = 2.0f; void Update () { Vector3 startPoint = new Vector3 (0, 0, 0); Vector3 endPoint = new Vector3 (0, 0, 3); transform.position = Vector3.Lerp (startPoint, endPoint, time); } |
©Coffee Break Codes – Move Object with Lerp – Unity3D (C#)
Great Awesome Tutorial . Please make more Tutorials on F.P.S. , A.I. , VR and AR also .