Download

First Person Shooter tutorial

Hey guys.

Well, I’m doing the first person shooter tutorial, and everything is going alright, so far.

I’m on the WASD section, and I’m on this part of code


void AFPSCharacter::MoveForward(float Value)
    {
        if ( (Controller != NULL) && (Value != 0.0f) )
        {
            // find out which way is forward
            FRotator Rotation = Controller->GetControlRotation();
            // Limit pitch when walking or falling
            if (GetCharacterMovement()->IsMovingOnGround() || GetCharacterMovement()->IsFalling() )
            {
                Rotation.Pitch = 0.0f;
            }
            // add movement in that direction
            const FVector Direction = FRotationMatrix(Rotation).GetScaledAxis(EAxis::X);
            AddMovementInput(Direction, Value);
        }
    }

When I go to debug, I get an error with GetCharacterMovement() function. I’m not sure why(I’m really new with Unreal Engine 4). I’m using UE 4.5.1 version.

Everything else works perfectly, it’s just theGetCharacterMovement() part that is not working.