# Help with finding orthogonal of vector? (Vector math)

Let me start off by saying I am in no way familiar with vector math, so excuse me if I misuse the terminology. My goal is to find a point on a line that is directly orthogonal/perpendicular to another line/vector

I’m having trouble figuring out the math needed to do this. Basically if a have a vector, such as between the HumanoidRootPart of the character and some position, I need to find a vector that’s horizontally perpendicular in order to then find a point on that line.

The red and yellow dots represent the HumanoidRootPart and some point. The green dot is a point im trying to find along the orthogonal vector.

https://gyazo.com/07286247a31385ecaed741d5d9bfd517

I tried looking up possible solutions, however none gave me the desired results and I wasn’t able to understand why as my knowledge of vector math is very limited. Any help on how to find the orthogonal vector would be much appreciated!

3 Likes

Given one vector in three dimensions, there is an infinite number of perpendicular vectors to consider. However, based on the images you helpfully supplied, it looks like you can narrow this down to just one vector by taking the Cross product of your “RootPart-to-SomePosition” vector with the world up vector (0, 1, 0). Vector3 has a built-in method (Cross) that you can use for this:

``````local perpVector = someVector:Cross(Vector3.new(0, 1, 0))
``````

Note that this perpendicular vector will not (necessarily) be unitary, so if you want to use it as a direction you may want to take the `.unit` of it after you do the Cross operation.

4 Likes