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

Triangle fixed

parent 66c11046
No related branches found
No related tags found
No related merge requests found
......@@ -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);
}
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment