This seems to be something that would be used in a lot of games, but I can’t find an answer to this.
What I want to do:
My player will contanstantly be hit by spheres, as she is hit with a sphere I wish to add force relative to the direction the sphere was heading and depending on where the player was hit.
For example if the player was hit on the left side by a sphere heading in the X direction, I would want the player to fly off in the x direction, with some z direction because she wasn’t hit in the center, she was hit on the side. If she was hit in the center she would head directly in the x direction.
I cant seem to add a picture, heres a link. I hope it helps.
The only solutions i’ve encountered is to add a physic material to the player, such as Bouncy, and give the spheres great mass. However I cannot do this in my game because it is networked.
Thanks, i know how to add the forces but i need to add the forces depending on where the player was hit. I presume it has something to do with adding collision from the collision point in the same velocity that the object was heading - an offset accounting for where in the rigidbody it was hit.
Does anyone know how to do this? As mentioned it would seem like a pretty common thing. Another example would be a player being hit by a car, you’d want the player to be pushed in the direction the car hit you and if you were hit on the side, you’d fly off to the side a bit.