# How to get perpendicular angle to vector?

**URL:** <https://forums.unrealengine.com/t/how-to-get-perpendicular-angle-to-vector/489824>\
**Category:** Community & Industry Discussion\
**Tags:** math, unreal-engine, vector, geometry, question\
**Created:** [October 13, 2021, 7:37am UTC](https://forums.unrealengine.com/t/how-to-get-perpendicular-angle-to-vector/489824 "2021-10-13T07:37:00Z")\
**Posts on this page:** 5\
**Page:** 1

<div class="post-metadata">

**Author:** ![Yaklakootmaa2](https://d1ap1mz92jnks1.cloudfront.net/user_avatar/forums.unrealengine.com/yaklakootmaa2/32/1194607_2.png) [@Yaklakootmaa2](https://forums.unrealengine.com/u/Yaklakootmaa2)\
**Post date:** [October 13, 2021, 7:37am UTC](https://forums.unrealengine.com/t/how-to-get-perpendicular-angle-to-vector/489824/1 "2021-10-13T07:37:00Z")

</div>

Is there a way to calculate the perpendicular angle to some vector?  
As a rotation axis, it will be Z

---

<div class="post-metadata">

**Author:** ![Tuerer](https://d1ap1mz92jnks1.cloudfront.net/user_avatar/forums.unrealengine.com/tuerer/32/1008648_2.png) [@Tuerer](https://forums.unrealengine.com/u/Tuerer)\
**Post date:** [October 13, 2021, 10:19am UTC](https://forums.unrealengine.com/t/how-to-get-perpendicular-angle-to-vector/489824/2 "2021-10-13T10:19:29Z")

</div>

In 3D space, an infinite number of vectors may be perpendicular to one vector. You need to be more specific.

If you have 2 vectors, you can calculate the cross product to get a vector perpendicular to both of them. In this case, only 2 results are possible.

If you only have one vector, you can rotate it 90 degrees to have a perpendicular vector. But then again, you’ll need a second vector to be the rotation axis.

---

<div class="post-metadata">

**Author:** ![Yaklakootmaa2](https://d1ap1mz92jnks1.cloudfront.net/user_avatar/forums.unrealengine.com/yaklakootmaa2/32/1194607_2.png) [@Yaklakootmaa2](https://forums.unrealengine.com/u/Yaklakootmaa2)\
**Post date:** [October 13, 2021, 3:12pm UTC](https://forums.unrealengine.com/t/how-to-get-perpendicular-angle-to-vector/489824/3 "2021-10-13T15:12:10Z")

</div>

Thank you. Sounds reasonable, I’ll look at the cross product

---

<div class="post-metadata">

**Author:** ![JeanChene666](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@JeanChene666](https://forums.unrealengine.com/u/JeanChene666)\
**Post date:** [October 26, 2022, 2:01am UTC](https://forums.unrealengine.com/t/how-to-get-perpendicular-angle-to-vector/489824/4 "2022-10-26T02:01:02Z")

</div>

Hey, I know it’s late, but here’s how I did it:  
Rotate a SpringArm with a Widget (nameplate attached):

I wanted to have the perpendicular angle between my camera and a target pawn to show the widget always on top (My pawn moves in 3D):

 ![image](https://d3kjluh73b9h9o.cloudfront.net/original/4X/a/9/c/a9c42b94439f536c583e18043f0af33dedc5f310.png)

Get the Up Vector of my camera, make a quat from it (because it’s a direction vector I can), set the rotation. Done.

---

<div class="post-metadata">

**Author:** ![Slava\_Go](https://d1ap1mz92jnks1.cloudfront.net/user_avatar/forums.unrealengine.com/slava_go/32/1179930_2.png) [@Slava\_Go](https://forums.unrealengine.com/u/Slava_Go)\
**Post date:** [May 18, 2024, 3:29pm UTC](https://forums.unrealengine.com/t/how-to-get-perpendicular-angle-to-vector/489824/5 "2024-05-18T15:29:58Z")

</div>

In case you need to do this in material, there is an example of Material Function to rotate a vector in XoY plane (vec2) around Z+ axis.

 ![rotate vector around Z+ axis](https://d3kjluh73b9h9o.cloudfront.net/original/4X/d/1/8/d1864bb672f89fa6aaaaac572560e9c034ff3e26.png)
