Problem with camera and animations in making a Unity FPS

I’m trying to create a very simple FPS in Unity for a school project. I purchased a cheap 3d model of a player from the asset store that has animations pre-loaded. I got everything with the movement down, but the only issue is that the player model’s head rotates when walking and sprinting. This is messing up my camera, which is currently a child of the all-encompassing GameObject, and making it follow the rotation of the head instead of staying still and exclusively listening to mouse input. What is the most effective way to solve this? I’ve tried making the camera the child of all the various components within the GameObject, but each and every component (head, spine, neck, etc) cause a similar problem. Any ideas? Would really appreciate any help.

Think the most used method is having the camera separate from the model, and in the camera script rotate the model based on mouse inputs. I’d also advice you to look into the standard assets character package.

Place the following script on your camera and add player in inspector…

public class TestCam : MonoBehaviour {

    public  GameObject player;
    public Vector3 offset;

	// Update is called once per frame
	void Update () {
        transform.position = player.transform.position + offset;
        transform.rotation = player.transform.rotation;

This is a very simple approach and you could do many things to make it better, but it will get you going. I added an offset variable so you can change the positioning in the inspector.

Good luck on your project

EDIT: Just reread your question and it seems you’re not making an FPS but a 3rd person shooter. If thats correct, he code may not be what you are looking for. I did a (very) quick search and found this, should give you what you need…