public void GetExtremePoint(Vector3 direction, ref RigidTransform shapeTransform, out Vector3 extremePoint) { GetExtremePointWithoutMargin(direction, ref shapeTransform, out extremePoint); float directionLength = direction.LengthSquared(); if (directionLength > Toolbox.Epsilon) { Vector3.Multiply(ref direction, collisionMargin / (float)Math.Sqrt(directionLength), out direction); Vector3.Add(ref extremePoint, ref direction, out extremePoint); } }
static void GetSweptExtremePoint(ConvexShape shape, ref Vector3 point, ref Vector3 sweep, ref Vector3 extremePointDirection, out Vector3 extremePoint) { shape.GetExtremePoint(extremePointDirection, ref Toolbox.RigidIdentity, out extremePoint); Vector3.Subtract(ref extremePoint, ref point, out extremePoint); float dot; Vector3.Dot(ref extremePointDirection, ref sweep, out dot); if (dot > 0) { Vector3.Add(ref extremePoint, ref sweep, out extremePoint); } }