# Struggling with movement input direction

**URL:** <https://forums.unrealengine.com/t/struggling-with-movement-input-direction/2120368>\
**Category:** C++\
**Tags:** c-c, c-class-wizard, c-and-bluepri, c-custommeshcomponen, c-and-blueprint, c-error, c-class, c-custom-shape, c-programming, c-cone-shape, unreal-engine, question, CPP\
**Created:** [November 13, 2024, 3:45pm UTC](https://forums.unrealengine.com/t/struggling-with-movement-input-direction/2120368 "2024-11-13T15:45:23Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![Phteven28](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@Phteven28](https://forums.unrealengine.com/u/Phteven28)\
**Post date:** [November 13, 2024, 3:45pm UTC](https://forums.unrealengine.com/t/struggling-with-movement-input-direction/2120368/1 "2024-11-13T15:45:23Z")

</div>

![DodgeDir SC](https://d3kjluh73b9h9o.cloudfront.net/original/4X/a/9/2/a92b2e2e163bbb9e3ef4230698cbad86cb89cf0f.png)

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/](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 🙂

Edit:

 ![DodgeDir2](https://d3kjluh73b9h9o.cloudfront.net/original/4X/b/4/a/b4adeefe7e428d09cf547433922cc1cc8f1ae146.png)  
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.

---

<div class="post-metadata">

**Author:** ![Phteven28](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@Phteven28](https://forums.unrealengine.com/u/Phteven28)\
**Post date:** [November 13, 2024, 4:18pm UTC](https://forums.unrealengine.com/t/struggling-with-movement-input-direction/2120368/2 "2024-11-13T16:18:41Z")

</div>

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

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);
	}
}

```

}

---

<div class="post-metadata">

**Author:** ![system](https://d3kjluh73b9h9o.cloudfront.net/original/4X/7/1/3/713c9d3f58553f0de89543d76a8a3a2779dc9fa4.png) [@system](https://forums.unrealengine.com/u/system)\
**Post date:** [December 14, 2024, 8:45pm UTC](https://forums.unrealengine.com/t/struggling-with-movement-input-direction/2120368/3 "2024-12-14T20:45:35Z")

</div>

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