Skip to content
Snippets Groups Projects
Commit 94b0d07a authored by mariuskern's avatar mariuskern
Browse files

Triangle Rotation fixed

parent eef3cbbf
Branches
No related tags found
No related merge requests found
......@@ -63,9 +63,19 @@ protected void calculate_vectors(){
Position = A;
Rotation = Quaternion.LookRotation(Vector3.Cross((B - A), (C - A)), Vector3.up);
//Rotation = Quaternion.LookRotation(forward, new Vector3(1.0F, 0.0F, 0.0F));
// Rotation = Quaternion.LookRotation(Vector3.Cross((B - A), (C - A)), Vector3.up);
// Rotation = Quaternion.LookRotation(forward, new Vector3(1.0F, 0.0F, 0.0F));
Vector3 forward = Vector3.Cross((B - A), (C - A));
Vector3 up = Vector3.up;
Vector3 crossForwardUp = Vector3.Cross(forward, up);
if (Mathf.Abs(crossForwardUp.magnitude) <= Mathf.Epsilon)
{
up = up + (C - c);
}
Rotation = Quaternion.LookRotation(forward, up);
}
public TriangleFact2() : base(){
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment