I have a racket and a tennis ball, my character swings the racket at the ball and the ball just kind of bounces off of it, there’s no real force applied. I need to add a force to the ball(which is easy) but I want to add the force in the direction along the normal of the racket’s collider… How do I script this???
Giving the ball a decent amount of bounciness in it’s material, and setting physics combine of materials to maximum should yield a really decent bounce without resorting to that. But if you do want to do it your way, you’ll need the normal from the collision from OnCollisionEnter, then you’ll use this exact normal (it is a Vector3) possibly with Vector3.Reflect in order to send it on it’s way. You’ll also need to use Forcemode.VelocityChange as the second parameter of Addforce, and this should be applied once. Finally you might need to multiply this by a fudge. A fudge, is an amount the programmer thinks will make it act or look good.
The above pretty much describes exactly how to do it, and where to look in docs (look up the command names), however I haven’t given you the script for it, as I don’t know if it’s necessary yet.
If I changed the bounciness of the ball wouldn’t that make it bounce unrealistically when it hits the ground??
bump
BUMP
I’d bet you aren’t getting an answer because you didn’t even bother trying it. Go try it, then come back with any problems you have.
So I upped the bounciness and the Bounce Combine was already on maximum… still not much difference… Does anybody know the best way to achieve what i’m trying to do???
bump
No need to keep bumping this every 15 minutes, if you really need help that bad, offer up some cash. By now anyone who would have helped probably has you on ignore for spamming.