# How to get a vector that's horizontal to another vector and is pointing in a specific direction?

**URL:** <https://forums.unrealengine.com/t/how-to-get-a-vector-thats-horizontal-to-another-vector-and-is-pointing-in-a-specific-direction/482881>\
**Category:** Rendering\
**Tags:** normal, unreal-engine, vector, question, Blueprint\
**Created:** [May 4, 2021, 3:04pm UTC](https://forums.unrealengine.com/t/how-to-get-a-vector-thats-horizontal-to-another-vector-and-is-pointing-in-a-specific-direction/482881 "2021-05-04T15:04:14Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![mindsurferdev](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@mindsurferdev](https://forums.unrealengine.com/u/mindsurferdev)\
**Post date:** [May 4, 2021, 3:04pm UTC](https://forums.unrealengine.com/t/how-to-get-a-vector-thats-horizontal-to-another-vector-and-is-pointing-in-a-specific-direction/482881/1 "2021-05-04T15:04:14Z")

</div>

Ok, so I’m trying to get a vector horizontal to the ground that my character is standing on AND I want it to be pointing in the direction the character is looking.

I’m currently getting the right vector of the **hit normal** and **setting the rotation** of a **scene component** with it, and then **getting the camera rotation** and **setting the rotation of the scene component** again to the **Z** of the camera rotation, but this doesn’t keep horizontal to the ground.

I feel like there is a simple mathematical solution for this but I have never been able to figure it out.

---

<div class="post-metadata">

**Author:** ![Everynone](https://d1ap1mz92jnks1.cloudfront.net/user_avatar/forums.unrealengine.com/everynone/32/1135017_2.png) [@Everynone](https://forums.unrealengine.com/u/Everynone)\
**Post date:** [May 4, 2021, 3:58pm UTC](https://forums.unrealengine.com/t/how-to-get-a-vector-thats-horizontal-to-another-vector-and-is-pointing-in-a-specific-direction/482881/2 "2021-05-04T15:58:51Z")

</div>

Sounds like this:

 ![337941-screenshot-2.png](https://d3kjluh73b9h9o.cloudfront.net/original/4X/3/0/1/301989e7531680288baf7a10d4ccb06ea2813e8f.png)

Instead of 1, feed it ground normal. There’s a couple of those, serving specific purposes.

---

<div class="post-metadata">

**Author:** ![Everynone](https://d1ap1mz92jnks1.cloudfront.net/user_avatar/forums.unrealengine.com/everynone/32/1135017_2.png) [@Everynone](https://forums.unrealengine.com/u/Everynone)\
**Post date:** [May 4, 2021, 4:00pm UTC](https://forums.unrealengine.com/t/how-to-get-a-vector-thats-horizontal-to-another-vector-and-is-pointing-in-a-specific-direction/482881/3 "2021-05-04T16:00:52Z")

</div>

If that’s not it then I severely misunderstood the description.

---

<div class="post-metadata">

**Author:** ![mindsurferdev](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@mindsurferdev](https://forums.unrealengine.com/u/mindsurferdev)\
**Post date:** [May 4, 2021, 4:25pm UTC](https://forums.unrealengine.com/t/how-to-get-a-vector-thats-horizontal-to-another-vector-and-is-pointing-in-a-specific-direction/482881/4 "2021-05-04T16:25:06Z")

</div>

I’m crying, it works wonderfully. Thank you.
