Struggling with movement input direction

Hey I’m trying to have the player rotate to the movement input direction upon initiating the animation. I saw another post with this framework but didn’t understand how they were getting “MovementInputDirection”.

https://www.reddit.com/r/unrealengine/comments/3g3xem/getting_the_world_direction_of_a_players_input/

I’m new to Unreal and C++ so if you can help, don’t spare the obvious thanks :slight_smile:

Edit:


This is closer to what I’m trying and provides better context. The dodge now launches the player in the intended direction but I’m unsure of how to set the character rotation to the movement direction.

This appears to work as I intended. Please let me know if there’s any pitfalls :slight_smile:

void APracticeMan::Dodge()
{

if (CanJump() && !IsDodging())
{
	UAnimInstance* AnimInst = GetMesh()->GetAnimInstance();
	if (AnimInst != nullptr)
	{

		bIsDodging = true;

		AnimInst->Montage_Play(DodgeRollFMon);
		FVector InputDirection = GetLastMovementInputVector();
		SetActorRotation(InputDirection.Rotation());
		LaunchCharacter(InputDirection * 2000, true, true);
	}
}

}

This topic was automatically closed 30 days after the last reply. New replies are no longer allowed.