Im having a problem with my project I have been working with, following the 3dbuzz tutorials for unity 3rd person system, all the way up to the end of integrating maya characters section (last of the system videos before starting “third person game” videos) and most everything has worked decent, but I am having problems with my animation states.
First off is that my jumping “state” of animation is never actually set as my characters state, even though as the videos show, I have coded things correctly I do beleive.
Here is a code snippet of the section where I have my “jumping” character state method:
void Jumping()
{
if (TP_Controller.CharacterController.isGrounded)
{
if (lastState == CharacterState.Running)
animation.CrossFade("RunLand");
else
animation.CrossFade("JumpLand");
State = CharacterState.Landing;
}
else if (!animation.IsPlaying("Jump"))
{
State = CharacterState.Falling;
animation.CrossFade("Falling");
}
else
{
State = CharacterState.Jumping;
// Help determine if we fell too far
}
}
//and here I have a snippet of my “jump” start action method(located elsewhere in animator script):
public void Jump()
{
if (!TP_Controller.CharacterController.isGrounded || IsDead || State == CharacterState.Jumping)
return;
lastState = State;
State = CharacterState.Jumping;
animation.CrossFade("Jumping");
}
and with these going as they are, I go into unity, and press space for my character to jump (which the character does indeed leave the ground because of my motor script) the player doesnt animate the “jump” animation, and doesnt ever enter the “jumping” state, just immeadiately it says he is into the “falling” state, which leads me to beleive the jump implementation isnt working for me?
Someone who has done the 3DBuzz tutorials would be best to answer this for me, but anyone who noticed a problem with coding in those methods or needs more info…feel free to chime in and help me get this working properly
maybe I made a silly typo or just followed along wrong in the videos, but as far as I can tell from re-watching them, the code seems legit… Maybe there is an error that 3DBuzz overlooked in the videos?
So anyway the whole reason this bothers me (cuz it looks alright even just going right into fall animation) is that I am trying to add another state for my character, and he would be off the ground in this state, so I need jumping to work right, so that when I do add the new methods, they work with if statements asking if the player is jumping and such…which right now, I would have to check if he is falling instead, and could lead to problems down the road…