Vector projection to other vector

  • Context:
  • Thread starter Thread starter twoski
  • Start date Start date
  • Tags Tags
    Projection Vector
Click For Summary
SUMMARY

This discussion focuses on projecting one vector (Vector A) onto another vector (Vector B) in a 3D space using a specified direction (Normalized Vector C). The user is working within Unity and finds the built-in projection function insufficient for their needs, prompting them to seek a custom solution. The mathematical foundation for vector projection is highlighted, particularly the use of the vector dot product, which simplifies the projection process.

PREREQUISITES
  • Understanding of vector mathematics, specifically vector projection.
  • Familiarity with Unity's Vector3 class and its projection function.
  • Knowledge of the dot product and its application in vector calculations.
  • Basic understanding of 3D coordinate systems and vector representation.
NEXT STEPS
  • Implement a custom vector projection function in Unity using the dot product.
  • Explore Unity's documentation on the Vector3 class for advanced vector operations.
  • Study mathematical concepts related to vector projections and their applications in 3D graphics.
  • Review examples of vector manipulation in Unity to enhance understanding of spatial transformations.
USEFUL FOR

Game developers, mathematicians, and anyone involved in 3D graphics programming who needs to understand vector projections and their implementation in Unity.

twoski
Messages
177
Reaction score
2
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

  • nlUJHEW.png
    nlUJHEW.png
    5.9 KB · Views: 418
  • PQh2BdO.png
    PQh2BdO.png
    1.5 KB · Views: 804
Last edited:
  • Like
Likes   Reactions: Delta2
Technology news on Phys.org
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.
 
I guess I ll not be able to help ..sorry
 

Similar threads

Replies
53
Views
5K
Replies
26
Views
2K
  • · Replies 146 ·
5
Replies
146
Views
11K
  • · Replies 66 ·
3
Replies
66
Views
6K
  • · Replies 9 ·
Replies
9
Views
4K
  • · Replies 20 ·
Replies
20
Views
2K
  • · Replies 1 ·
Replies
1
Views
2K
  • · Replies 19 ·
Replies
19
Views
4K
  • · Replies 1 ·
Replies
1
Views
3K
Replies
13
Views
3K