I want to move my gameobject to move point A to target point B like sine wave, I have used Vector2.Lerp but its just straight line. so far I tried many ways and I managed this
//sine wave
vLastPos = new Vector2(transform.position.x , Mathf.Sin(Time.time)*2f+2f);
transform.position = vLastPos+Vector2.right*Time.deltaTime;
but the problem is its moving the gameobject left to right not to target position. the gameobject shold reach the target position and stop. please help me.
No comments:
Post a Comment