Question by
Peeteus · Feb 11, 2021 at 11:58 AM ·
2d-physicsknockback
How to addforce to the player in opposite direction of gun rotation?
Hi, I wanted to make it so that when the player fires the gun, which rotates depending on the mouse position, will add a force to the player sending them in the opposite direction, sort of like a knockback effect.
I know I have to use something like rb.AddForce(); to the player however I am unable to figure out how to use the gun's rotation as a way to depend what force is added. The gun is a child of the player GameObject.
Many thanks!
Comment
Your answer
