static public void SnapBoundsAndPreserveArea(ref Bounds bounds, float snapSize, Vector3 offset) { Vector3 newCenter = Mathw.Snap(bounds.center, snapSize) + offset; bounds.size += Mathw.Abs(newCenter - bounds.center) * 2; bounds.center = newCenter; }
// Token: 0x060025AA RID: 9642 RVA: 0x000BC264 File Offset: 0x000BA464 public static void SnapBoundsAndPreserveArea(ref Bounds bounds, float snapSize, Vector3 offset) { Vector3 vector = Mathw.Snap(bounds.center, snapSize) + offset; bounds.size += Mathw.Abs(vector - bounds.center) * 2f; bounds.center = vector; }
// Token: 0x0600258D RID: 9613 RVA: 0x000BB6F0 File Offset: 0x000B98F0 public static bool IntersectAABB3Triangle3(Vector3 boxCenter, Vector3 boxHalfSize, Triangle3 triangle) { Vector3 vector = triangle.a - boxCenter; Vector3 vector2 = triangle.b - boxCenter; Vector3 vector3 = triangle.c - boxCenter; Vector3 lhs = vector2 - vector; Vector3 rhs = vector3 - vector2; Vector3 vector4 = vector - vector3; float fb = Mathw.Abs(lhs[0]); float num = Mathw.Abs(lhs[1]); float fa = Mathw.Abs(lhs[2]); float num2; float num3; if (!Mathw.AxisTest_X01(vector, vector3, boxHalfSize, lhs[2], lhs[1], fa, num, out num2, out num3)) { return(false); } if (!Mathw.AxisTest_Y02(vector, vector3, boxHalfSize, lhs[2], lhs[0], fa, fb, out num2, out num3)) { return(false); } if (!Mathw.AxisTest_Z12(vector2, vector3, boxHalfSize, lhs[1], lhs[0], num, fb, out num2, out num3)) { return(false); } fb = Mathw.Abs(rhs[0]); num = Mathw.Abs(rhs[1]); fa = Mathw.Abs(rhs[2]); if (!Mathw.AxisTest_X01(vector, vector3, boxHalfSize, rhs[2], rhs[1], fa, num, out num2, out num3)) { return(false); } if (!Mathw.AxisTest_Y02(vector, vector3, boxHalfSize, rhs[2], rhs[0], fa, fb, out num2, out num3)) { return(false); } if (!Mathw.AxisTest_Z0(vector, vector2, boxHalfSize, rhs[1], rhs[0], num, fb, out num2, out num3)) { return(false); } fb = Mathw.Abs(vector4[0]); num = Mathw.Abs(vector4[1]); fa = Mathw.Abs(vector4[2]); if (!Mathw.AxisTest_X2(vector, vector2, boxHalfSize, vector4[2], vector4[1], fa, num, out num2, out num3)) { return(false); } if (!Mathw.AxisTest_Y1(vector, vector2, boxHalfSize, vector4[2], vector4[0], fa, fb, out num2, out num3)) { return(false); } if (!Mathw.AxisTest_Z12(vector2, vector3, boxHalfSize, vector4[1], vector4[0], num, fb, out num2, out num3)) { return(false); } Mathw.GetMinMax(vector[0], vector2[0], vector3[0], out num2, out num3); if (num2 > boxHalfSize[0] || num3 < -boxHalfSize[0]) { return(false); } Mathw.GetMinMax(vector[1], vector2[1], vector3[1], out num2, out num3); if (num2 > boxHalfSize[1] || num3 < -boxHalfSize[1]) { return(false); } Mathw.GetMinMax(vector[2], vector2[2], vector3[2], out num2, out num3); return(num2 <= boxHalfSize[2] && num3 >= -boxHalfSize[2] && Mathw.PlaneBoxOverlap(Vector3.Cross(lhs, rhs), vector, boxHalfSize)); }