- Home /
Question by
WeirderChimp · Jan 22, 2016 at 08:41 AM ·
animatormecanimstatestate-machinetransitions
Checking Transitions in Animator
Hey.
How do i check what state Mecanim is transitioning to?
The reason i ask is because im making a state machine but im only in Stand State if there is no transition going on but i wasnt it to set the current state if then state is being transitioned to. for Example: if im crouched and transition to prone i want to be in Prone state as soon as it starts transitioning from Crouched to Prone.
im finding the current state of the character like this: (Update Function)
currentLocomotionState = anim.GetCurrentAnimatorStateInfo(0);
if(currentLocomotionState.fullPathHash == StandState){
//Stand State
}else if(currentLocomotionState.fullPathHash == CrouchState){
//Crouch State
}else if(currentLocomotionState.fullPathHash == ProneState){
//ProneState
}else if(currentLocomotionState.fullPathHash == GetUpState){
//Get Up State
}
and "StandState" is defined like this for example:
static int StandState = Animator.StringToHash("Locomotion.Stand");
IM thinking Something like this would be great but i dont know if it exists in unity.
if(currentLocomotionState.fullPathHash == StandState || currentLocomotionState.StateTransitioningTo.fullPathHash == StandState ){
//Stand State
}
Thanks For Reading ~Scott
Comment