how to make player follow touch with Force or velocity?
I am working on something similiar to : https://www.youtube.com/watch?v=yB2r5anbvgA but mobile
And i am stuck on a simple situation where i want a player to follow my finger but i want him to get velocity from this movement ( so i can curve the ball properly ) so i can't use something like this:
rg.transform.position = Vector3.MoveTowards(rg.transform.position, new Vector3(pos.x, pos.y, rg.position.z), speed * Time.deltaTime);
but when i try to add force or set constant velocity:
cam.ScreenToWorldPoint(new Vector3(Input.GetTouch(0).position.x, Input.GetTouch(0).position.y, 4.37f));
Vector3 direction = pos - rg.transform.position;
rg.AddForce(direction.normalized * speed * Time.smoothDeltaTime);
i am stuck on unnatural behaviour ( mostly weird oscillating movement when reaching touch position ). I tried detecting this moment and setting velocity to zero but it only made matters worse. Do you have any idea how can i make player follow touch with velocity or do you have any idea how i can simulate curve ball on collision with player when it's velocity is zero?
Also, z axis of player is constant if this helps.
Your answer
Follow this Question
Related Questions
How to get static speed 1 Answer
Falling Platform 1 Answer
Convert x y axis velocity to angle and speed 1 Answer
Adding down force(velocity) to the player 0 Answers
Strange behavior when applying forces. 0 Answers