diff --git a/Assets/Scripts/InteractionEngine/FactHandling/Facts/PyramidFact.cs b/Assets/Scripts/InteractionEngine/FactHandling/Facts/PyramidFact.cs index 121a7246384de1199d658166619a652d71e68fa0..2aadb6b1d8e3e8aeefdd2844397ebd98111504af 100644 --- a/Assets/Scripts/InteractionEngine/FactHandling/Facts/PyramidFact.cs +++ b/Assets/Scripts/InteractionEngine/FactHandling/Facts/PyramidFact.cs @@ -35,7 +35,7 @@ protected void calculate_vectors(){ C = GetR.C + Vector3.zero; D = GetD.Point + Vector3.zero; - D_offset = D - B; + D_offset = Quaternion.AngleAxis(-90, Vector3.right) * (D - B); /* Vector3 d_AB = A + Vector3.Project(D - A, B - A); @@ -52,9 +52,17 @@ protected void calculate_vectors(){ Volume = 1/3 * GetR.Area * Vector3.Distance(M, D); - Position = GetR.Position; + Position = B; - Rotation = GetR.Rotation; + Vector3 forward = Vector3.Cross((C - B), (A - B)); + Vector3 up = A - B; + + if ((A - B).y < 0) + { + up = -up; + } + + Rotation = Quaternion.LookRotation(forward, up); } public PyramidFact() : base(){