# Vector projection to other vector

• C/++/#

## Main Question or Discussion Point

Let's say i have 2 arbitrary vectors in a 3d space. I want to project Vector A to Vector B using a specified normal.

edit: better image

A is green, B is red, C is red arrow. Blue is result.

In this case, i want to project green vector to red vector in the red direction. This would give me the blue vector as a result.

I'm working in unity and they have a projection function, but it doesn't operate how i want it to... So i guess i need to make my own.

Here is the projection function they do have: https://docs.unity3d.com/ScriptReference/Vector3.Project.html

#### Attachments

• 30.7 KB Views: 215
• 4.2 KB Views: 419
Last edited:

Related Programming and Computer Science News on Phys.org
Arman777
Gold Member
The drawing is really bad. Can you try to explain what are you trying to do mathematically ?

As I understand you have three vectors, $\vec {A},\vec {B},\vec {C}$ you want to project $\vec {A}$ on $\vec {B}$. on direction $\vec {C}$ ?

Isnt it the same as A projection on C ? Since A projection on B gives you a vector on B direction and then you want to project it again on C ?

If this is true I can help you with the code part. I guess at least for the math part.

Sorry that's not a great picture. A and B are 2 vectors in a 3d Space. I want to project Vector B to Vector A in a given direction, ie. Normalized Vector C.

Arman777
Gold Member
I guess I ll not be able to help ..sorry

jedishrfu
Mentor