# Rotate direction vector to actor rotation?

**URL:** <https://forums.unrealengine.com/t/rotate-direction-vector-to-actor-rotation/449516>\
**Category:** Character & Animation\
**Tags:** rotator, rotation, rotation-direction, unreal-engine, rotate, question\
**Created:** [May 24, 2019, 9:45pm UTC](https://forums.unrealengine.com/t/rotate-direction-vector-to-actor-rotation/449516 "2019-05-24T21:45:43Z")\
**Posts on this page:** 6\
**Page:** 1

<div class="post-metadata">

**Author:** ![Ardenian](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@Ardenian](https://forums.unrealengine.com/u/Ardenian)\
**Post date:** [May 24, 2019, 9:45pm UTC](https://forums.unrealengine.com/t/rotate-direction-vector-to-actor-rotation/449516/1 "2019-05-24T21:45:43Z")

</div>

Hello,  
I wrote myself an actor component that simulates hover movement over WorldStatic objects.

Using LineTraceForObjects, I search for the WorldStatic object under my character, then I use the resulting Impact Normal with an offset to set my character’s new position. Now I try to update the actor’s rotation to match the input direction of the player, however, I have great problems getting this to work. This is how my current blueprint looks like:

 ![277809-hover-movement-rotation.png](https://d3kjluh73b9h9o.cloudfront.net/original/4X/a/2/6/a26b6f67bd71190505119b0fa0c74f4d9ed126d3.png)

As you can see, I use the Forward Vector of my character’s rotation because that works. However, now my character doesn’t update its facing, obviously, and I don’t know how to change it so that it does. In the picture, you can also see the direction vector to the middle bottom, this is the actual direciton vector that the player inputs and now I have to rotate this vector so it matches my character, who has a rotation around all axes. I tried RotateVector on this direction vector with my character’s rotation, but it results in a very strange behavior of my character.

If I have a direction vector, like (1.0,0,0), and I would like to transform this vector so that it matches a character’s rotation, how do I do this? To give an instance, (1.0,0,0) is the Forward Vector, however, my character is rotated and now I would like to transform this direction vector so that it is the Forward Vector of my character.

Any help is greatly appreciated!

---

<div class="post-metadata">

**Author:** ![DavidOConnor](https://d1ap1mz92jnks1.cloudfront.net/user_avatar/forums.unrealengine.com/davidoconnor/32/978533_2.png) [@DavidOConnor](https://forums.unrealengine.com/u/DavidOConnor)\
**Post date:** [May 31, 2019, 4:34am UTC](https://forums.unrealengine.com/t/rotate-direction-vector-to-actor-rotation/449516/2 "2019-05-31T04:34:23Z")

</div>

… a key reason you are having this issue is that when an **Actor** is a player… it’s rotations are driven by **Set Control Rotation** (not **Set World Rotation** ). Perhaps try this first of all, and see if it resolves your issue.

---

<div class="post-metadata">

**Author:** ![Ardenian](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@Ardenian](https://forums.unrealengine.com/u/Ardenian)\
**Post date:** [May 31, 2019, 6:44pm UTC](https://forums.unrealengine.com/t/rotate-direction-vector-to-actor-rotation/449516/3 "2019-05-31T18:44:22Z")

</div>

Thank you for your response, unfortunately using Set Control Rotation doesn’t seem to work as I think it should. Viewing the character in the inspector doesn’t show any change in rotation and setting a break point to the Set Control Rotation element shows that there is a small change in rotation, but it seems to reset afterwards. Here is what I do:

 ![278534-hover-movement-rotation2.png](https://d3kjluh73b9h9o.cloudfront.net/original/4X/f/8/6/f861124f7c4c49720801e0f88e5d7e9cf32cbec2.png)

I would appreciate if you could help me again.

---

<div class="post-metadata">

**Author:** ![DavidOConnor](https://d1ap1mz92jnks1.cloudfront.net/user_avatar/forums.unrealengine.com/davidoconnor/32/978533_2.png) [@DavidOConnor](https://forums.unrealengine.com/u/DavidOConnor)\
**Post date:** [June 1, 2019, 5:47am UTC](https://forums.unrealengine.com/t/rotate-direction-vector-to-actor-rotation/449516/4 "2019-06-01T05:47:31Z")

</div>

honestly, without drilling into quite a lot of detail on this… I’m not sure…

first, I’d check that **Set Control Rotation** is affecting your character’s rotation by adding some test rotations.

second, I’d check that the **Impact Normal** is giving you right rotation…

once you are sure those are correct, we can look at the elements of your BP between these two key points…

---

<div class="post-metadata">

**Author:** ![Ardenian](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@Ardenian](https://forums.unrealengine.com/u/Ardenian)\
**Post date:** [June 10, 2019, 12:43pm UTC](https://forums.unrealengine.com/t/rotate-direction-vector-to-actor-rotation/449516/5 "2019-06-10T12:43:42Z")

</div>

Thank you again for your reply. As it turns out, my pawn is not a player controller, as casting my pawn to controller fails, for some reason and thus **Set Control Rotation** doesn’t have any impact, will have to investigate what is going wrong there.

Additionally, the **Make Vector** action, as seen in my previous screenshot, being created from the input axis, also doesn’t create the proper vector. if the input is (x=0.00, y=1.00, z=0.00), then the resulting vector will be (x=0,00, y=0.00, z=0.00). Don’t know if there is some kind of weird floating point thing going on here or what else it could be.

---

<div class="post-metadata">

**Author:** ![DavidOConnor](https://d1ap1mz92jnks1.cloudfront.net/user_avatar/forums.unrealengine.com/davidoconnor/32/978533_2.png) [@DavidOConnor](https://forums.unrealengine.com/u/DavidOConnor)\
**Post date:** [June 11, 2019, 12:37am UTC](https://forums.unrealengine.com/t/rotate-direction-vector-to-actor-rotation/449516/6 "2019-06-11T00:37:42Z")

</div>

mmmm… the first thing I’d suggest is double-checking that your player **pawn** (or **character** ) and **player controller** are properly set up… generally, you need both working together… I’d definitely check out a video or two on this. From your above comment, there is perhaps some confusion because a **pawn** isn’t a **player controller** and vice versa

Once the casting is giving you the right pawn/controller… perhaps go through the steps above ( **Set Control rotation** and check **Impact Normal** are giving your the right results)?
