I'm trying to get a "climb ledge" animation to work with my character controller. Right now, my climb ledge animation will play out but when I go to sync up the players new position with the ending position of the animation the rotation of my mesh is buggered:
If I move using WSAD after that then the rotation seems corrected:
The code starts with the player being near to a climbable surface:
RaycastHit hit; if( Physics.Raycast( transform.position, transform.forward, out hit, 1.0f ) ) { if( hit.transform.gameObject.tag == "Climbable" ) { animation.CrossFade( "ClimbUpOnLedge" ); } }
The animation plays, and I have an Animation Event which calls the following method after the animation is done playing:
public void ClimbUpOnLedgeCompleted( )
{
transform.position = pivot.transform.position;
animation.CrossFade( "MeleeIdle" );
}
Seems pretty basic to me - but i'm missing something here, can anyone help?