I’ve created a third person camera script (and followed a few tutorials to see if I’m doing anything wrong). I had this working perfectly on a test character model which was just a cylinder. Now that I’ve imported my actual character model with animations, I noticed the camera is following each of the animations. This means when my character is in the idle position and moving his head, it also turns the camera. When I swing with the sword, the camera follows the sword. I’m not understanding how to fix this. I have created an empty cameraFollow as a child to the character, and then a cameraBase empty that holds the cameraFollow. The cameraBase has the camera script on it.
I know the script itself is working, because I had used it prior and tried a few different tutorials to ensure I didn’t mess anything up. However, it’s tracking the animations no matter what I do and I can’t find a solution. Ultimately I ended up using the script found here:
As I thought this would fix my problem, but it still remains. Is it something within the animations themselves? I didn’t make the character, so maybe there’s something I don’t know about.
It’s appearing like whenever I tried childing anything to the character, it’s the whole character model - so the camera moves with it all. So if I put the camera follow object as the parent, it works when standing still, but upon movement the character runs away from the camera.
Could be that the animation is moving the character (root motion)
If this is the case, then perhaps you want to make a proxy object where your camera is now, then a script that drives ONLY the position to that point, but gets the rotation from something else.
If it is NOT root motion driving the player forward, you can bypass the animated hierarchy and hang the camera outside of it:
I think the animation is moving the character. The other person working on the project created and rigged the character in Blender, but used Mixamo for the animations. I tried creating the hierarchy as you listed above, but getting the same results. Whenever the char turns his head in the idle animation it pans the camera to the left and right.
Update: I’ve got the camera to stop following the player’s animation. It follows my player properly, but my player and camera are moving independent of each other. When I turn the mouse, the camera moves a bit, but the player can turn 180 so that he’s facing the camera. I am trying to keep the camera behind the player at all times, so you can only ever see the player’s back.
Edit:
Using
transform.forward = player.transform.forward;
or
Using transform.LookAt(player);
Cause the camera to shake again with the animations