Gun Recoil

PuzzlerPenguin

New member
Hello,

I have tried going through the various related forum posts for a solution but have not been able to find one that has helped me to figure out my issue.

My problem: I have gone through all the tutorial videos and have everything working. However, whenever I adjust the recoil it seems to just make the screen shake harder. I have tried changing the Position Recoil and the Camera Recoil. Whenever I use the Camera Recoil Accumulation my arms start floating away from my characters body. I am using a Synty model and have followed the tutorials for using the FPS Mesh Tool and the Assault Rifle animation is working. Have I done something wrong that is causing the Camera Recoil Accumulation to make my FPS Arms float away? I know in one thread I read they had said something about the demo animator having recoil built in so the recoil variables don't work? I am not sure I understood correctly. Any help would be much appreciated. Thanks!
 
What do you want to achieve? The demo animations contain some recoil which means that you can't remove the recoil completely.
 
I was just looking to add recoil like in most fps games that very between guns, more than likely moving diagonally up and to the right. However, currently when I change the variables it just shakes the gun and arms or the camera. Is this the intended version of recoil? If not do you have any recommendations on what could be wrong or documentation to look at? Thanks for the reply.
 
The recoil adds a random force in the range defined by the settings on the weapon. For instance, the assault rifle in the demo adds only a force to the -z direction (which is how physics recoil works). The springs will then move the arms back into position.
But you can add a force element to the xy plane so you also get a diagonal movement. You might play with the spring settings to get a smoother movement.
 
I am attempting to look into the spring settings. I tried messing with the spring settings connected to my rifle in the Item's area. However, these seemed to not have the desired impact. I was looking for the springs for the camera and was trying to use this documentation First Person - Opsive but was unable to find any adjustable springs on either the Main Camera or the First Person Camera. Any recommendations where I might find these?

Also, I was watching this video YouTube Video and the guy uses Spread and the Camera Recoil Accumulation along with the recoil values to achieve a recoil pattern I would like to be able to replicate. I am also using First Person instead of Third Person so perhaps this is the issue? However, if I turn the Camera Recoil Accumulation to anything besides 0 my camera and arms will start floating away from my body with each shot taken. Is this a known issue with a solution or should I start from scratch to try to fix it?

Here I made a video showing some of the issues I am having: My YouTube Video
 
Last edited:
If you are using the FPS Mesh Tool then it uses the humanoid animations which have recoil. You will need to swap out the animations to prevent that from happening. The Camera Recoil Accumulation will prevent the camera from shaking.
 
Would that entail making a new animation controller or could I replace the animations in the demo to make sure it works first? And doing this will make the recoil work properly?
 
If you want separate animations for first person you will need to use a different animator controller. You can then replace the animations with one that doesn't have any recoil. FPS Mesh Tool is great for prototyping a character but you do lose a lot of the fine grain controls by using a humanoid animator. Your issue is related to the animations and not the camera.
 
Oh okay, sorry for the confusion on my part. So the issue is the animations in combination with the FPS Mesh Tool not producing a humanoid character? For example the Nolan arms wouldn’t have this issue?
 
If you're referring to the generic first person arms then no, they use the spring system for recoil rather than pure animations.
 
Okay, thanks for all the help! I appreciate it. I’m going to look into making my own animation controller and hopefully that takes care of everything.
 
Hello again, I have been playing around changing the animations to humanoid and building my own character controller. However, this still has not allowed for me to add recoil. After adding an assault rifle if I change the Camera Recoil Position to all zeros and then make the Camera Recoil Accumulation 0.5 the gun will slowly move straight upwards with no left to right recoil. I tried the online example of the First Person Controller web version on the Opsive website and after picking up the assault rifle tested the recoil and I believe it goes up and right diagonally. This is what I would like to be able to do in my game. I then followed the tutorial videos using the Nolan character model and the Nolan arms model. Alas, when I have the Camera Recoil Accumulation on and add Camera Recoil Position the arms float away like in my video. I am using the demo animation controllers.

Is this still due to the animations being generic and not humanoid? I attempted to replace the animations in the demo controller with humanoid animations I bought from the Unity Asset Store and still had the same results. Full transparency the animation wasn't working correctly because it was for a whole person and not for just the arms. But in the controller the correct animation state was still activating. Is the demo game on the website using different things than what comes with the first person controller?

This is the demo I was using: First Person Controller Demo Game. If you go pick up the assault rifle and shoot it at the wall notice the diagonal recoil.

Edit: the recoil in the demo looks like it is randomized. Is this just done using the spread slider? Does that mean recoil can only be random? I also booted up the demo in unity and if I change the camera recoil position the arms fly away. Is the Camera Recoil Position not supposed to be used? Or am I using it wrong?
 
Last edited:
The camera recoil doesn't affect the arms - it only affects the camera. In first person mode there are no actual recoil animations. It is all procedural and has some randomness to it. In the demo scene if you go to the first person springs room and shoot the pistol (you'll need to add some ammo) you'll see that there is no recoil at all. This is because the recoil is set to 0 on both the item (affecting the arms) and set to 0 for the camera.
 
Top