Simple scenario: sitting down.
Now, to sit down, things for me should go like this:
- Interact with chair
- Trigger a boolean (isSitting) in the player character, which the AnimBP will use for the animation
- Do not allow the player to use any movement input during the animation
- Play the standing up animation when the player tries to move again, which means the movement input is technically being used for a different purpose (triggering again the boolean isSitting)
- Enable normal movement input
But here’s the problem. Everything goes right until I try to use movement inputs to stand up instead of moving. I can’t outright disable the input movement because I still need it to disable the sitting down, but this doesn’t work in my controller:
void AProtagonistController::MoveForward(float axisValue)
{
if(aControlledCharacter->GetIsResting() && axisValue)
{
aControlledCharacter->StopResting();
}
else
{
FVector playerForwardVector = aControlledCharacter->GetActorForwardVector();
aControlledCharacter->AddMovementInput(playerForwardVector,axisValue);
}
}
Because axisValue is always equal to 0, which also makes me wonder how the heck AddMovementInput works to begin with.