3DBuzz Platformer Tutorials - I can't get Jumping to Work

Hi guys,

This might be relatively long due to the code involved. I’m doing the Unity/C# free 3d platformer tutorials over on 3DBuzz and I’m up to the stage where you implement jump, fall, and land animations. In short - the problem is that it simply doesn’t work.

My code is completely identical to theirs in every necessary way. Of course the names of animations are different and some things like that, but nothing that can affect anything.

I have rewatched the jumping/falling/landing videos over ten times each, there is no variation in relevant code, not a single bracket or capital is missed, or anything. And I’m freaking sick of rewatching videos that I’ve completed.

In it’s current state the character jumps, the character falls, the character teleports to the ground and does not play a landing animation.

Pay attention to the Debug.Log lines, I put comments in those for testing purposes. There is this section of code here:

void Jumping()
{
    Debug.Log("Here is the problem");
    if ((!animation.isPlaying && TP_Controller.CharacterController.isGrounded) ||
        TP_Controller.CharacterController.isGrounded)
    {
        Debug.Log("The above statement is NEVER true, it will never come here");
        if (lastState == CharacterState.Running)
        {
            animation.CrossFade("LandRun");
            Debug.Log("This will never happen");
        }
        else
        {
            animation.CrossFade("LandStationary");
            Debug.Log("This will never happen, either");
        }
    }
    else if (!animation.IsPlaying("JumpStationary"))
    {
        Debug.Log("This happens");
        State = CharacterState.Falling;
        animation.CrossFade("FallStationary");

    }
    else
    {
        Debug.Log("This does not happen either");
        State = CharacterState.Jumping;
    }
}

It doesn’t make sense, their code works and mine doesn’t yet their code is the exact same.

From memory (I did the tutorial a while ago now) there was some problems popping up for me too. There is a video right near the end called debugging, they fix up alot of the error that are in the project, so maybe watch that. (I fixed an error myself, and then got to the end an they said “you’ll have to fix this”, made me laugh. I’m not sure what video you are up to, so here’s my Jumping function when it was completed/working.

void DetermineCurrentState()
{
    if (MyState == CharacterState.Dead)
        return;

    // check if falling
    if (!TP_Controller.myCharacterController.isGrounded)
    {
        if (MyState != CharacterState.Falling && 
        MyState != CharacterState.Jumping && 
        MyState != CharacterState.Landing)
        {
            // We should be falling at this point
            Fall();
        }
    }

    // check if not doing anything related to motion
    if (MyState != CharacterState.Falling && 
    MyState != CharacterState.Jumping && 
    MyState != CharacterState.Landing &&
    MyState != CharacterState.Using && 
    MyState != CharacterState.Climbing && 
    MyState != CharacterState.Sliding)
    {
        switch (MoveDirection)
        {
            case [ ....... ]





void Jumping()
{
    if ((!animation.isPlaying && TP_Controller.myCharacterController.isGrounded) ||
                TP_Controller.myCharacterController.isGrounded)
    {
        if (lastState == CharacterState.Running) 
            // running landing
            animation.CrossFade("TPCperson1_JumpLanding");
        else 
            // jumping landing
            animation.CrossFade("TPCperson1_JumpLanding");

        // set state to landing
        MyState = CharacterState.Landing;
    }
    else if (!animation.IsPlaying("TPCperson1_Jumping"))
    {
        MyState = CharacterState.Falling;
        // falling
        animation.CrossFade("TPCperson1_Falling");
        TP_Motor.Instance.IsFalling = true;
    }
    else
    {
        // jumping
        MyState = CharacterState.Jumping;

        // help determine if Player has fallen too far
    }
}

@UnityAnswers why have you made posting code so damn difficult? and then change the finished product from that of the preview? #$@% !