static bool VerifySimplex(ref Vector3 v0, ref Vector3 v1, ref Vector3 v2, ref Vector3 v3, ref Vector3 direction)
{
//v1, v0, v3
Vector3 cross = Vector3.Cross(v0 - v1, v3 - v1);
float planeProduct1 = Vector3.Dot(cross, direction);
//v3, v0, v2
cross = Vector3.Cross(v0 - v3, v2 - v3);
float planeProduct2 = Vector3.Dot(cross, direction);
//v2, v0, v1
cross = Vector3.Cross(v0 - v2, v1 - v2);
float planeProduct3 = Vector3.Dot(cross, direction);
return (planeProduct1 <= 0 && planeProduct2 <= 0 && planeProduct3 <= 0) ||
(planeProduct1 >= 0 && planeProduct2 >= 0 && planeProduct3 >= 0);
}