A ball drops down, how to reverse the velocity?

A ball drops down how do i go about reversing the velocity to make the ball go back?

2 Answers

2

First you'll have to detect if it's hitting the ground. You can use OnTriggerEnter for that. If the ground is parallel to the x-axis you'd just need to reverse the y component of your velocity. If you need a more general approach you can use Vector3.Reflect.

You can also try adding a rigidbody with gravity to your ball, and giving it 'bouncy' physics properties so it would bounce naturally.