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

Pyramid fixed

parent 7436c251
No related branches found
No related tags found
No related merge requests found
...@@ -35,7 +35,7 @@ protected void calculate_vectors(){ ...@@ -35,7 +35,7 @@ protected void calculate_vectors(){
C = GetR.C + Vector3.zero; C = GetR.C + Vector3.zero;
D = GetD.Point + 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); Vector3 d_AB = A + Vector3.Project(D - A, B - A);
...@@ -52,9 +52,17 @@ protected void calculate_vectors(){ ...@@ -52,9 +52,17 @@ protected void calculate_vectors(){
Volume = 1/3 * GetR.Area * Vector3.Distance(M, D); 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(){ public PyramidFact() : base(){
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment