Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Update Vector3.cs #26

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
16 changes: 8 additions & 8 deletions Runtime/Export/Math/Vector3.cs
Original file line number Diff line number Diff line change
Expand Up @@ -296,10 +296,10 @@ public static Vector3 Project(Vector3 vector, Vector3 onNormal)
return zero;
else
{
var dot = Dot(vector, onNormal);
return new Vector3(onNormal.x * dot / sqrMag,
onNormal.y * dot / sqrMag,
onNormal.z * dot / sqrMag);
var dotSqrMag = Dot(vector, onNormal)/ sqrMag;
return new Vector3(onNormal.x * dotSqrMag,
onNormal.y * dotSqrMag,
onNormal.z * dotSqrMag);
}
}

Expand All @@ -312,10 +312,10 @@ public static Vector3 ProjectOnPlane(Vector3 vector, Vector3 planeNormal)
return vector;
else
{
var dot = Dot(vector, planeNormal);
return new Vector3(vector.x - planeNormal.x * dot / sqrMag,
vector.y - planeNormal.y * dot / sqrMag,
vector.z - planeNormal.z * dot / sqrMag);
var dotSqrMag = Dot(vector, planeNormal)/ sqrMag;
return new Vector3(vector.x - planeNormal.x * dotSqrMag,
vector.y - planeNormal.y * dotSqrMag,
vector.z - planeNormal.z * dotSqrMag);
}
}

Expand Down