True FPS camera issues

Hey guys I’m new here. I’m kinda stuck in my project. I was attempting a true fps controller for the past few months.

Everything works nicely but I have a bit of a vertical headbob which I’m trying to remove.

The camera is the child object of a spring arm and is attached to the head which takes care of the rotations issues. The pitch of the controller is driven by the head rotation via an aim offset.

I found out that star citizen devs somehow fixed it with some ik but I cannot understand how he did it.

Link to the star citizen dev diary

This guy says he solved it using a similar approach while handling his fps view.

Can anybody help me with this?

Like I have posted several times.
Head Bob needs to die.

The reason behind the motion you are seeing is the animations.
Depending on the quality of the movement animations the head Bob will be more or less severe.

To truly remove the head Bob you need to unparent the camera from the head bone.

What parenting does (though in faster code then BP) is to match the world space location of the head bone to that of the spring arm.

What you can do in code, is lessen the amount that the head bobbles around by setting some limits against which to check before allowing for a Lerped transition to occur.

Why is that? Simple. You can parent to the root, but then if your animations are supposed to offset the camera they will not. So, for a crouching animation for instance, your camera will no longer follow the head.
You have to correct this by code when the movement exceeds a pre-set threshold. And you need to make sure that your animations maintain this threshold as well.

Other hacks to consider, if you are in a game where you never see your face, disable it from view (but enable shadows) and it will never clip your camera.

If you cannot do so (maybe you are making some magic mirror room game?) Then the alternative would be to custom tune each and every single animation with a few curves that are then fed into and manage the camera.

Animation curves can be very powerful for this purpose, and most importantly, since you can copy and paste them from the animation of the bones, they can be dead accurate. Even more so then parenting/socketing I find.

The silly way around to skip all the fine tuning, is to simply force the headbone to stay in place (ignore Z, apply x and y). This can have some odd behaviour, But, because the headbone travels along with the rest of the body, it makes it easier to disable/enable this “follow no follow” behaviour based on how much the Z moves around.
It doesn’t fix the x and y, and often looks silly.
Generally, it works fine in games that dont show the character.
Crysis comes to mind, as one of the games where this happens constantly when peeking through cover. You may want to google for some images of that to understand the extent to which no one cares about what the mesh is doing when in cover… actually, no. Here you go
Do notice, there is no head either, and yet you would have never known while playing.…ying-hilarious

I did consider doing that but then when including things like player self shadows and mirror reflections, messing up the player model would not be a good idea. Any idea how star citizen did this though as someone did manage to pull it off the same way on ue4 but I can’t get in touch with the guy.

Also the only movement I experience in the camera now is z axis and on the y axis. I’m trying to lock the head in place and make the rest of the body compensate using ik to look normal. Standing stance seems to work but I’m still figuring out how to handle this on stance change

Judging from the bird example they gave, they are using a full-body IK solution and simply use IK to lock the head in place. My first intuition would be to create an IK target bone where the neck is and animate that very smooth without any headbobbing and then rotate the final head target around that with the rotation input you get from the mouse/controller. Something like this:
I will try to implement this for my own project and will share my findings.

Also how do I go about aligning the gun perfectly to the camera like how Wolfenstein does it? I tried camera placement with ik to keep neck in place and place the cam using timeline on stance change. Ik does not seem to be working properly for me.

I’d just hard copy the rotation from the camera to the head bone, not the other way around. And to avoid slight shakiness from imperfect IK I would probably use the IK target bone for the camera location. Now getting the gun to align perfectly with the camera requires either really good IK or you do roughly adjust the upper body and then just yank the arms into the correct place relative to the camera. (I have no idea what Wolfenstein does since I haven’t played any of the Wolfenstein games)

Just like in real life, You never put your head on the stock, the rifle come into your view.
Basically you just set the weapon’s front sight as the master IK and you match alignment to the z of the camera exaclty.
The hands will come up with the IK chain, and you should be good to go.

Could you give me an example of how I could set this up. Ik seems to be messed up when I try doing this

Placing the camera independently to the place where the head should be seems to work after putting an ik on the neck the keep the upper body from moving. I use a timeline to smoothly interpolate the camera Dow or up with stance change. So I guess headbob issue is solved. I’ll still keep a cam on the headsocket for cutscenes or montages I guess.

I might share my solution someday after the hand placement is solved

well take pubg for example. They did use the animation starter pack to a large extent. How do you think they did it?

Judging from threads like this:
Different animations for first person view.

hmm and how about rainbow six since the thirp person bug confirms it’s the same model they are using for both views. I just wanna compare approaches to this

Some links would be helpful to make clear we are talking about the same thing. But from what I have found that happens after people use their drone, which means they have already left their body. If the bug is showing the first person animations though you can see a ton of head movement going on which is clearly not reproduced by the camera when you actually are in first person, so they aren’t copying the head position exactly with their camera.
Also in rainbow six, your own character doesn’t seem to cast any shadow in first person, which is a strong indicator that the mesh and animations get changed when that bug happens.

see this

Most of the movement animations available are over exaggerated, based on self conscious actor/models running on treadmills or placing a spring in their step,

Soldiers are not celebrating the first day of spring and the joy of life, perky young school girl skipping across the meadow to pick flowers?
I think not, grim determination and a heavy heart are the hallmarks of a soldiers gait.

Well that’s my excuse for mellowing out the head bob inside the animations to remove bobbing at the source, reworking the animations based on steady head position for walk, slight bob for jog and a steady aim animation for toggling breathing while stationary.

Just another approach, depending on needs and skill-set might be an idea.
In the rainbow clip other players movements did not look very head bob ish.

Yes, that happens after he used some kind of drone or camera and to me, the first person and the third person running animations look very different (look at the way he holds the gun). They are using different/adjusted animations for first person.

I’ll get back to you on your Q after the game-jam.
For now, suffice to say that you can dig into the IK Content example on your own along with the IK training videos
That’s the base from which you start.
As you will see (or already saw) the hands have a Root bone.
What you want to do then is link a socket placed on the Front Sight, one place on the Rear sight (so you can line them up and get a picture perfect sight), and shift the weapon up enough to get those 2 sockets to have the same Z as center camera (with a scalar for adjustment so that different sights can be offset easily).

there is a very small amount of headbob which is vertical and some forward movement of the head. I took advice from witch-dev and unpatented the camera from the head and instead place the camera smoothly in local space using timeline to predicted positions. I fixed the neck position so that it is always below the camera using ik for now. No headbob and everything looks fine for now. But how to align the hands with the gun now?

Hand placement is via TwoBoneIK node in animgraph , quick look

Ok I managed to align the hands using a combination of an aim offset with hands locked in front of the camera in ik and using fabrik nodes. The only problem now is that the hands sway sideways while looking up and down