I am making a first person game and now that I finished the writing the main code for movement and aiming, I want to try creating a mesh for the player.
Since the game is first person, my thought process is to make my character mesh as 3 components: Body (no arms or head), Arms, Head (head would be used in a Vanity view to show equipment).
Then in my player scene I have the body mesh which would follow the horizontal rotation (I want the body mesh so the player can look down and see feet), and the arms would be parented with the camera so they follow where the player is looking.
I feel like this is a reasonable approach and I have a pretty confident I could set this up. One caveat though is that with the arms following the camera, the shadows will likely show them disconnected from the body. I would also need a way to have the head cast shadows even when it is not visible. Any feedback would be much appreciated!
I would say there are two common approaches here.
One thing many FPS games do is have a separate model for first person and third person. The first person model is visible to the player, and the third person model is used to cast shadows/visible to other players. You can animate the 3rd person model fully, and reuse the animations for the 1st person arms (or vice versa), or animate them separately (which I believe is what games like CS2 do, where the animations between 1st and 3rd person don’t line up perfectly so that it looks better in 3rd person). There is a bit of set up here since you will have to make both models play corresponding animations at once, and make sure that the body of the 3rd person model rotates where the camera is looking as well.
The second less common approach (which I believe is used in games like PUBG) is to attach the camera to the 3rd person body, and hide the head in 1st person, and then rotate the spine bones of the 3rd person model to line up with the mouse input to make it look correct. This is the more difficult approach tho since it’s very prone to camera clipping through the model, but it has the benefit of only needing to set up one model, and animations will be consistent between 1st and 3rd person.
1 Like
I have found that separating the character into multiple meshes to be a lot of unnecessary work, and to look bad when dealing with accessories like clothing selection (if you decide to have such a feature down the line). Joints like shoulders don’t look right when exposed, though they can be creatively hidden to minimize the effect.
I have found that creating a single character model works well, though it introduces more work requirements in some areas. On the flipside, it reduces work in other areas.
Attach the camera to the head bone, offset just a bit in front of the head where the eyes are, so it rotates along with the head. Use an AnimationTree with bone filters to do things like positioning the arms appropriately depending on context (running or walking while holding weapons vs. running or walking without holding anything).
The end benefit is that you only need one model and one set of animations.
1 Like