- Home /
 
               Question by 
               LucKy232 · Jun 27, 2014 at 12:02 PM · 
                vector3planesperpendicular  
              
 
              Find segment point perpendicular to plane
I have 2 Vector3 points, and I have to find a point which creates a segment perpendicular to the plane formed by these 2 points and Vector.up.

As in, I have 'a' and 'b' and I have to find the red points. I have no idea how this could be done.
               Comment
              
 
               
               
               Best Answer 
              
 
              Answer by Kiwasi · Jun 27, 2014 at 12:03 PM
Google vector cross product. Should do the job nicely
This works. In all honesty, I've tried this before, but failed to implement it correctly because I called "Vector3.up" as the 3rd point in the function, and not "a + Vector3.up". As in, 'up' relative to point 'a';
Code from docs.unity3d.com which I used: (in case anyone stumbles on this in the future and needs it)
 Vector3 GetNormal(Vector3 a, Vector3 b, Vector3 c) {
     Vector3 side1 = b - a;
     Vector3 side2 = c - a;
     return Vector3.Cross(side1, side2).normalized;
 }
Your answer
 
 
              koobas.hobune.stream
koobas.hobune.stream 
                       
                
                       
			     
			 
                