Trouble with implementing a recoil system

Brodster987

New member
I use the Opsive controller for movement but I have my own weapons system. I was trying to add procedural recoil for my guns off of a YouTube video. The system works by attaching your camera to a game object that rotates to simulate the gun recoil. Since the recoil is on a separate object the gun can return to the starting position ignoring any rotation that had been made by the player. However when I'm using the character controller the character bugs out. I think that the character controller is resisting the rotation. It also may not be lined up with the parent since the parent that controls the recoil does not move with the camera. I believe it would work if I could put the camera control scripts on the object at the top of my hierarchy that the recoil controller and then camera is are attached to but when I try this the character will not move at all. I've also tried anchoring the main camera to the recoil controller but as far as I can tell this had no effect.

How can I get a recoil to work by using a object that is higher in the hierarchy then the main camera?

This is my Hierarchy set up.

Camera Anchor (empty game object, what I tried to get the camera controller to work on)
----Camera Recoil (contains the recoil script)
-----------Main Camera (the one that normally is linked to the First person character controller)

Here is the link to the YouTube video for the procedural recoil.
 
The camera controller controls the position and rotation of the camera, but also the direction of the character. So it is not a good idea to try to move the camera from the outside.

The camera controller allows to add a secondary force to the camera through an event (
"OnAddSecondaryCameraForce"). This is how the shootable weapon adds recoil to the camera. If this is not sufficient for you, you can also write your own view type:
 
Top