Announcement

Collapse
No announcement yet.

Pawn doesn't move

Collapse
X
 
  • Filter
  • Time
  • Show
Clear All
new posts

    Pawn doesn't move

    My Pawn can look around but doesn't move .I'm trying to move my custom pawn with inputs. I created a new pawn instead a character because i want to be able to attach items on it. If i use character i can't attach the items to the specific sockets because mesh component which has sockets is not the root component and couldn't find a solution to make it root component. So i decided to do it with pawn. Attach function works fine, but now i can't move my pawn. Here is my code.



    void AMenimJisus::SetupPlayerInputComponent(UInputComponent* PlayerInputComponent)
    {
    Super::SetupPlayerInputComponent(PlayerInputComponent);

    if (InputComponent)
    {
    InputComponent->BindAxis("MoveForwardBackward", this, &AMenimJisus::MoveForwardBackward);
    InputComponent->BindAxis("MoveLeftRight", this, &AMenimJisus::MoveLeftRight);
    InputComponent->BindAxis("LookUpDown", this, &AMenimJisus::LookY);
    InputComponent->BindAxis("LookLeftRight", this, &AMenimJisus::LookX);
    }
    else
    {
    UE_LOG(LogTemp, Warning, TEXT("Input Component bulunamadi"))
    }
    }

    void AMenimJisus::MoveForwardBackward(float value)
    {
    if (Controller && value)
    {
    UE_LOG(LogTemp, Warning, TEXT("%f"),value)
    AddMovementInput(GetActorForwardVector(), value);
    }
    }

    void AMenimJisus::MoveLeftRight(float value)
    {
    if (Controller && value)
    {
    AddMovementInput(GetActorRightVector(), value);
    }
    }

    void AMenimJisus::LookX(float value)
    {
    if (Controller && value)
    {
    AddControllerYawInput(value);
    }
    }

    void AMenimJisus::LookY(float value)
    {
    if (Controller && value)
    {
    AddControllerPitchInput(value);
    }
    }
Working...
X