I’m making a 3d FPS and trying to make it so that when I fire a gun the player is pushed back the opposite direction
If your character is using a CharacterController then it really depends on the script you’re using to control it. But if your character is using a rigidbody then you can do it with something like this:
GetComponent<Rigidbody>().AddForce(-transform.forward*5);
ah ty but my player itself does not rotate the camera does to emulate an fps like feel
then use -Camera.main.transform.forward instead of -transform.forward.
Find the transform.forward of the gun, and then use the code that @zulo3d commented, just replacing
-transform.foward with -gun.transform.forward.
thank you