Cinemachine Target Group

Hi there, at this point in the course, I wonder, when I hit the tab button and focus on the target, why don’t I return to the animation mode when I press the escape button? When I click the escape button, my character goes into a T pose and not back to its animation. This isn’t right, is it? I am receiving two warning messages.

Warning messages:

  1. Animator.GotoState: State could not be found

  2. Invalid Layer Index ‘-1’

When I check the Player in the PlayerRig, I see the Player(Animator) is attached to the Animator in the Player State Machine script.

Invalid Layer Index -1 takes me to the PlayerFreeLookState script on line 18. Here, I can’t see any real issues, so I think maybe, at this point, the character is meant to go back into a T pose once you press escape and that this T pose problem will be sorted in the later lesson or am I completely wrong and the character should return to its animation state?

Please share the code of your PlayerFreeLookState, and the exact messages in the console.

This generally happens when there are no states in the Animator that match the state you are trying to switch to in the code.
Compare the name of the PlayerFreeLook Blend tree in the Animator and make sure that name matches exactly the name of the state you are switching in PlayerFreeLookState(). Spelling and case matter, so “FreelookState” is not the same as “FreeLookState”

Hi guys, thanks for the reply and sorry for the reply. I have looked at my FreeLookBlend tree and it is spelt: FreeLookBlendtree.

I have just changed it to FreeLookBlendTree and now it works. However, a new issue arose which is the mouse cursor. When I press escape, the player now animates but when I move the mouse cursor the camera snaps really fast and strangely, I find it hard to describe it really. Wondering if changing the name of the FreeLookBlendTree was the right thing to do.

As for the code in the PlayerFreeLookState, its the same code as the one on gitlab.

[SOLVED]

I just figured it out :man_facepalming:

In the PlayerRig > StateDrivenCamera I was missing the FreeLookCamera in the Virtual Camera Children field.

1 Like

Great job getting that sorted!

:muscle:

This topic was automatically closed 24 hours after the last reply. New replies are no longer allowed.

Privacy & Terms