diff --git a/Assets/Scripts/InteractionEngine/FactHandling/Facts/TriangleFact2.cs b/Assets/Scripts/InteractionEngine/FactHandling/Facts/TriangleFact2.cs index 5487bf40f62dcad176e4bda71f3d9d9a66a27458..24b29c2dedd58d47ed4410904eac09b95307e8fa 100644 --- a/Assets/Scripts/InteractionEngine/FactHandling/Facts/TriangleFact2.cs +++ b/Assets/Scripts/InteractionEngine/FactHandling/Facts/TriangleFact2.cs @@ -66,6 +66,8 @@ protected void calculate_vectors(){ // 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; @@ -80,6 +82,26 @@ protected void calculate_vectors(){ up = -up; } + Rotation = Quaternion.LookRotation(forward, up); + */ + + + Vector3 forward = Vector3.Cross((B - A), (C - A)); + Vector3 up = C - c; + + /* + Vector3 crossForwardUp = Vector3.Cross(forward, up); + if (Mathf.Abs(crossForwardUp.magnitude) <= Mathf.Epsilon) + { + up = up + (C - c); + } + */ + + if ((C - c).y < 0) + { + up = -up; + } + Rotation = Quaternion.LookRotation(forward, up); }