- Home /
3DBuzz Third Person Character Jumping And Landing Issue
Hey everyone, I hope you've all had a great day so far.
As I continue on with the 3DBuzz tutorial series on a third person character and camera system, I'm running into more and more problems, some of which I can solve, some of which I have no clue how to solve. This particular issue is concerning the jumping and landing animations. Essentially, I can jump up just fine, but without animations, use the proper falling animation, and land just fine, yet without animations, either. My code for this functionality is as follows.
In TP_Animator.
void Jumping()
{
if (!anims.isPlaying && TP_Controller.Character_Controller.isGrounded ||
TP_Controller.Character_Controller.isGrounded)
{
if (lastState == CharacterState.WalkingForward)
anims.CrossFade("Jump Land"); //Intended to have a specific animation, such as a walking land, which doesn't exist yet
else
anims.CrossFade("Jump Land");
State = CharacterState.Landing;
}
else if (!anims.IsPlaying ("Jump Up"))
{
State = CharacterState.Falling;
anims.CrossFade ("Bind Pose"); //Intended for a falling animation, which doesn't exist yet
}
else
{
State = CharacterState.Jumping;
//Help determine if the player has fallen too far
}
}
public void Jump()
{
if (!TP_Controller.Character_Controller.isGrounded || IsDead || State == CharacterState.Jumping)
return;
lastState = State;
State = CharacterState.Jumping;
anims.CrossFade("Jump Up");
}
void Landing()
{
if (lastState == CharacterState.WalkingForward)
{
if (!anims.IsPlaying("Jump Land")) //Intended to be the walking land animation, which doesn't exist yet
{
State = CharacterState.WalkingForward;
anims.Play ("Forward Walking");
}
}
else
{
if (!anims.IsPlaying("Jump Land"))
{
State = CharacterState.Idle;
anims.Play ("Idle");
}
}
}
In TP_Controller.
void HandleActionInput()
{
if (Input.GetButton("Jump"))
{
Jump ();
}
//Not used as of yet
if (Input.GetKeyDown(KeyCode.E))
{
Use ();
}
}
void Jump()
{
//Check to see if the player is sliding, if so, don't allow jumping because
//they can glitch out the sliding by jumping up the incline
if(!TP_Motor.Instance.isSliding)
{
//Check to see if the player is allowed to jump
if (canJump)
{
//Disallow the player from jumping, which sets off a timer
canJump = false;
TP_Motor.Instance.Jump();
TP_Animator.Instance.Jump();
}
else
return;
}
}
To elaborate, I've logged extensively and found that my jump and land animations, as well as their associated functions, are indeed being called, but are so brief that the animations hardly ever register. I can, on some occasions, see a very brief glimmer of the landing animation, but have yet to see any hint of the jump animation during game-play.
Thank you for your time in reading this, and have a great day! -Hypocrita_20XX