Issue with Camera Rotation - Third Person Camera

I am trying to recreate the camera from the Third Person Asset example in my third person game I am making but I am having a vital issue. I have my hierarchy setup almost the same as the Asset example, I am using the cinemachine camera’s almost identically except using cinemachine camera because virtual camera has been deprecated. The issue I am having is that I have a free revolving camera around the player and the movement logic works correctly in that it moves in relation to the camera. The problem is that when the player parent gameobject moves in relation to the camera, it brings the camera follow position with it because my follow position is a child of the player gameobject. When I look at the Third Person Asset example they have the follow position object as a child of the player gameobject but when the parent player gameobject moves, the follow object doesn’t take it’s rotation even though it is child of the player gameobject.

I have tried multiple ways of manipulating my scripts to get this working and can’t seem to fix it. I’m pretty inexperienced in game development so sorry if I’m not making sense. I’d be happy to share my scripts, just let me know.

I’m not sure what the StarterAssets do to implement this, but very likely in their character controller code they have some logic to deal with this.

Alternatively, you can look at the implementation in the samples that ship with CM3. Look at the ThirdPersonWithAimMode sample scene. In it, you’ll find a player prefab with scripts to handle what you describe. The CM sample controller comes in two parts: one on the player itself and one on the child object (PlayerAimingCore). On that child object, there is a mode setting to control whether the child’s rotation is coupled to the parent or independent:

You can build your own controller based on that sample, if you want. Or just use it as-is.

Hey Gregory, thanks for the reply. Sorry to ask the question this way, as I am not super experienced, but I am on CM3 and I don’t have any of the scenes or scripts you’re talking about in package’d folders anywhere. Did I not fully install CM3 properly?

Install the Cinemachine 3D samples from the Package Manager:

1 Like