Setting two surface normals to face points separated by 90-degrees

Hello,

I am looking to make the two legs of a right angle triangle-part face the direction of two points which are 90 degrees apart, and would be centered on each triangle legs’ surface normal. Where the points are represented by Vector3 values, and the points can have any 2d-plane orientation.

I understand the process of pointing objects in the direction of another given object, yet I am unsure on how to point two surfaces in a specific direction as mentioned above.

Simply setting one face to a given point and altering the parts of the rotation matrix by 90 degree increments to get the other face pointing correctly will not suffice, since I am looking to have this work in all orientations.

Help would be greatly appreciated, thanks!

If I understand this correctly the normal vectors are given and you want to rotate a wedge.

If so then just do this:

local NV1= --your code here, stands for normal vector 1
local NV2= --your code here, stands for normal vector 2
local NV3= NV1:Cross(NV2)
local pos=  --your code here, stands for position
local WedgeCFrame=CFrame.new(
pos.x,pos.y,pos.z,
NV3.x,NV2.x,NV1.x,
NV3.y,NV2.y,NV1.y,
NV3.z,NV2.z,NV2.z)

You might have to rotate it.

1 Like

Given he’s rotating a wedge, I’m pretty sure this is a mandatory step ;p

1 Like

Thanks for the reply, although this is not what I was looking for.

I recently discovered my own solution which involves directly setting each part of the rotation matrix to face the appropriate orthogonal unit directions. :slightly_smiling_face: