How can I make a ball roll when using Vector3.MoveTowards?
I am making a game where the player can dribble with the ball. I use Vector3.MoveTowards to make sure the ball is gets in front of the player when it gets close enough. I recently gave the ball a texture and the ball wasnt rolling whenever the player was dribbling. The rotation it has before you start dribbling keeps going when I dribble. This is my code for dribbling.
if (playerCloseToBall)
{
float step = Time.deltaTime * DribbleStrength;
Vector3 playerPos = new Vector3(transform.forward.x, 0.15f, transform.forward.z);
ball.transform.position = Vector3.MoveTowards(ball.transform.position, transform.position + playerpos, step);
}
How can I make it so that the ball rolls whenever I dribble to a certain direction?
Your answer
Follow this Question
Related Questions
Enemy not facing player when enter rotation orbit 0 Answers
How to transform a GameObject to an Empty GameObject's position and rotation 1 Answer
Car Controls without physics. 1 Answer
How do I change the position of my player model after I rotate it so it's not teleporting? 0 Answers
Real life frame position to relative position to camera rotation 0 Answers