- Home /
Question by
WeirderChimp · Jan 21, 2016 at 01:11 PM ·
animatormecanim
Sub States and FullPathHash/StringToHash
Hey. So im Wondering How i check if mecanim is playing ANY animation in a sub State. here are my Variables
public MCS_LocomotionStates CharacterLocomotionState;
private AnimatorStateInfo currentLocomotionState;//this holds the current locomotion state
static int StandState = Animator.StringToHash("Locomotion.Stand");//this is defining the stand state
static int CrouchState = Animator.StringToHash("Locomotion.Crouch");
static int ProneState = Animator.StringToHash("Locomotion.Prone");
static int JumpAirTimeState = Animator.StringToHash("Locomotion.JumpAirTime");
and here is my code for when i check in "Update" to see if what state im in
//----- STATES -----\\
currentLocomotionState = anim.GetCurrentAnimatorStateInfo(0);
if(currentLocomotionState.fullPathHash == StandState){
//Standing
}else if(currentLocomotionState.fullPathHash == CrouchState){
//Crouching
}else if(currentLocomotionState.fullPathHash == ProneState){
//Prone
}else if(currentLocomotionState.fullPathHash == JumpAirTimeState){
//InAir
}
the Problem im having is with The Jumping. Locomotion is the layer and JumpAirTime is a sub state. how do i get FulPathHashto return "Locomotion.JumpAirTime" if any of the animation in the JumpAirTime Sub State are playing.
Thanks for reading ~Scott
Comment