Basically what I need is a way to get the forward Vector3 from 3 Vector3’s that form a triangle, where the tip is “forward”. I need this for certain reactions to physics in certain scenarios, if I could get help, it’d be greatly appreciated.
What do you mean by the foward Vector3?
The point opposite to the shortest side or the normalvector or somethingelse entirely?
Actually, I would prefer an entire CFrame, so I can detect tilting, but basically from the base to the tip, if the tip moved up, it’d look up, if the triangle were to turn, it would turn, etc. etc.
with 3 vectors, you can form some 2d triangle in some plane, but what defines what the “tip” is? or are you defining a “tip” and then trying to generate some vector from that “tip”?
predefined stuff, mainly from raycasts, but I want to get the angle of that triangle for certain things, can anyone help? Here’s a little diagram.
So from what I see, you want to define a triangle with 3 points, a, b, and c, thus forming a triangle.
You then define another point; for example, b. You then want to connect that point b to face B of the triangle, and form a vector from face B to point b?
If this is what you are trying to do, I would find the midpoint of points a and c, lets call it d. With that point d, you can now form a vector with an origin of d, and ending at b.
If this wasn’t what you were looking for, comment again please
what if it was facing perfectly up, wouldn’t pointing using CFrame.new return a direction not even representing the angle, I also need the normal in some way (could use upvector but <<<)
i meant representing the normal, how could I get the normal derp
If you want the normal of the triangle, calculate vector AB and vector AC, then calculate the CROSS product.
edit: writing demo code, also cross product, not dot sorry
psuedo code or something please?
while wait(0.1) do local a = game.Workspace["A"].Position local b = game.Workspace["B"].Position local c = game.Workspace["C"].Position local ab = a-b local cb = c-b print(cb:Cross(ab)) game.Workspace.PointyThing.CFrame = CFrame.new(Vector3.new(0,0,0), cb:Cross(ab)) end
Maybe this helps? Green Block is point B, and the red line is the normal vector
does it work properly when facing straight up?