Vector projection to other vector

  • C/++/#
  • Thread starter twoski
  • Start date
  • #1
181
2

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

PQh2BdO.png


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

Last edited:

Answers and Replies

  • #2
1,735
138
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.
 
  • #3
181
2
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.
 
  • #4
1,735
138
I guess I ll not be able to help ..sorry
 
  • #5
11,516
5,063

Related Threads on Vector projection to other vector

Replies
0
Views
547
Replies
2
Views
24K
  • Last Post
Replies
8
Views
3K
  • Last Post
Replies
4
Views
2K
  • Last Post
Replies
3
Views
2K
  • Last Post
Replies
5
Views
592
Replies
4
Views
3K
Replies
7
Views
727
Replies
6
Views
5K
Replies
122
Views
8K
Top