Getting First-Person Camera right

avalonsutra

New member
I need some help with getting the first-person (combat) camera to work properly. I think I wasted days by now trying to get it to act like I desire it but so far unsuccessful, so I have several questions about it ...

I'm using UCC 3.1, the goal is to create a game prototype with first-person (first person combat camera) mode and third-person adventure camera mode. The player is able to switch between these two modes. So far the third-person camera works as desired but only if I chose the character's body as the camera target manually (if it uses the character's head the camera will wobble when walking).

1. When in play mode and trying to change the first-person camera x/y/z offsets, the values change but the camera doesn't move. I remember this used to work and I could adjust the camera's position easily this way. But it stopped working and I have no clue why. Any idea?

2. When using the character body as the camera target (as explained above) I have to set a camera target offset of 1 meter or the camera would be too low. However with the first-person camera this makes the camera be inside the body at chest height and it cannot be changed as the offsets don't change. How can I fix this problem?

3. How do I get the first-person camera to be following the character smoothly? It seems the first-person camera follows the character's animation every movement and all its undesired effects, so the camera wobbles with every walk step, when the character turns the camera position changes and wobbles, it feels like the character walks on eggs and therefore movement feels very unrefined. My goal is to have the first-person camera to change position in a more linear way, and don't change position when the character stands still and rotates. I don't know how to explain it better but most games have a very smooth camera that does not follow every change an animation makes, for example Minecraft just to get an idea of what I mean. How can I achieve this with UCC?
 
I have an additional question ...

I've created a new scene and new UCC with first-person and third-person modes because I want to exclude any possible influences from other components. I've set my custom animation controller to be used on the Animator component of my character. This works in third-person mode but in first-person mode for some reason it still uses the demo controller even though the inspector shows that my custom controller is set. What's going on?
 
Actually, how would UCC need to be set up for the following scenario:

- A game that supports multi-player mode and single-player mode.
- Therefore the game should both feature first person (enforced in multiplayer) and third-person mode (optional in single player).
- Because of this it is desired to use complete character meshes in first-person mode and the same animations as in third-person mode.

Because of this I'm not setting up first-person arm meshes for FP mode and instead let it use the third-person character mesh but I'm running into the above issue where it always falls back to use the demo animation controller. Any advice how this can be solved?+
 
1. When in play mode and trying to change the first-person camera x/y/z offsets, the values change but the camera doesn't move. I remember this used to work and I could adjust the camera's position easily this way. But it stopped working and I have no clue why. Any idea?
Which offset are you referring to? The Look Offset on the view type? I just changed it and it worked correctly.

2. When using the character body as the camera target (as explained above) I have to set a camera target offset of 1 meter or the camera would be too low. However with the first-person camera this makes the camera be inside the body at chest height and it cannot be changed as the offsets don't change. How can I fix this problem?
You should set a different offset for each view type.

3. How do I get the first-person camera to be following the character smoothly? It seems the first-person camera follows the character's animation every movement and all its undesired effects, so the camera wobbles with every walk step, when the character turns the camera position changes and wobbles, it feels like the character walks on eggs and therefore movement feels very unrefined. My goal is to have the first-person camera to change position in a more linear way, and don't change position when the character stands still and rotates. I don't know how to explain it better but most games have a very smooth camera that does not follow every change an animation makes, for example Minecraft just to get an idea of what I mean. How can I achieve this with UCC?
I believe from one of your other posts you changed the animations and are now baking in the vertical displacement? Does the demo scene behave as you'd expect? This setup is the same as what you are going for - adventure for third person and combat for first person.
I've created a new scene and new UCC with first-person and third-person modes because I want to exclude any possible influences from other components. I've set my custom animation controller to be used on the Animator component of my character. This works in third-person mode but in first-person mode for some reason it still uses the demo controller even though the inspector shows that my custom controller is set. What's going on?
First person uses a different animator controller than what is on the main character. The first person animator controller is set on the child of the First Person Objects GameObject. If you do a component search for ChildAnimatorMonitor you'll see the GameObject.
- A game that supports multi-player mode and single-player mode.
- Therefore the game should both feature first person (enforced in multiplayer) and third-person mode (optional in single player).
- Because of this it is desired to use complete character meshes in first-person mode and the same animations as in third-person mode.

Because of this I'm not setting up first-person arm meshes for FP mode and instead let it use the third-person character mesh but I'm running into the above issue where it always falls back to use the demo animation controller. Any advice how this can be solved?+
You should set up a both perspective character like normal. This is what we do for the PUN add-on. On remote clients the first person arms are disabled so you never see them except for the local player. Do you have the PUN add-on? If not I recommend taking a look at it as it shows a good example of how to set up a multiplayer environment.
 
Hi Justin,

thanks for the replies! A lot has been resolved or better understood yesterday evening for the issues ...

- First of all, the demo animations used in first-person came from my custom controller. I figured after someone on the Discord told me that first-person uses the Aim states and I hadn't changed anything about these states so far.

- The undesired camera movement in first-person obviously depends on the animations. Yes, the demo animations work better with it. My custom anims cause some issues in first-person, especially the rotation anims where the camera moves because of the feet movement when the character is rotated. I have yet to see how to improve this. Perhaps I have to edit the animations.

> Do you have the PUN add-on? If not I recommend taking a look at it as it shows a good example of how to set up a multiplayer environment.

I was planning to check it out later. I'm gonna have a look at it!

> On remote clients the first person arms are disabled so you never see them except for the local player.

Thanks for the hint! This is very useful to know!
 
Top