A minor detail but when the climbing animation is done it snaps back to the idle position where the player is no longer clipping which is quite jarring (camera also snaps up). Noticed that in the tutorial this doesn’t happen for him. How would I go about fixing this?
Are you using stateMachine.Animator.CrossFadeInFixedTime? The first thing I would try is increasing the time for this crossfade.
That didn’t fix it. I don’t know why it worked for him in the lesson video but I think its clipping just because that’s where the animation finishes so it ignores collisions.
I was thinking more about the snapping/jarring effect. In terms of the foot going through the roof, remember that the animations are not tied to the physics system in any way. The CharacterController is a glorified Capsule Collider, and this is what is used to determine the elevation of the character.
To fix the foot is a bit more complicated, and could almost be a course in and of itself. For that, you need to
- Determine if the character is grounded (easy enough, the CharacterController will tell you)
- Create an Inverse Kinematics chain in the skeleton of the character
- Raycast from a bit above each foot downwards to the ground
- Adjust the position of the foot to compensate for the correct ground position
- Only do this when immediately landing, or for each foot at the point in the animation that the foot touches the ground (Animation Events can help with this).