public override void GetBoundingBox(ref RigidTransform shapeTransform, out BoundingBox boundingBox)
{
#if !WINDOWS
boundingBox = new BoundingBox();
#endif
var upExtreme = new Vector3(0, halfLength, 0);
var downExtreme = new Vector3(0, -halfLength, 0);
Vector3.Transform(ref upExtreme, ref shapeTransform.Orientation, out upExtreme);
Vector3.Transform(ref downExtreme, ref shapeTransform.Orientation, out downExtreme);
if (upExtreme.X > downExtreme.X)
{
boundingBox.Max.X = upExtreme.X;
boundingBox.Min.X = downExtreme.X;
}
else
{
boundingBox.Max.X = downExtreme.X;
boundingBox.Min.X = upExtreme.X;
}
if (upExtreme.Y > downExtreme.Y)
{
boundingBox.Max.Y = upExtreme.Y;
boundingBox.Min.Y = downExtreme.Y;
}
else
{
boundingBox.Max.Y = downExtreme.Y;
boundingBox.Min.Y = upExtreme.Y;
}
if (upExtreme.Z > downExtreme.Z)
{
boundingBox.Max.Z = upExtreme.Z;
boundingBox.Min.Z = downExtreme.Z;
}
else
{
boundingBox.Max.Z = downExtreme.Z;
boundingBox.Min.Z = upExtreme.Z;
}
boundingBox.Min.X += shapeTransform.Position.X - collisionMargin;
boundingBox.Min.Y += shapeTransform.Position.Y - collisionMargin;
boundingBox.Min.Z += shapeTransform.Position.Z - collisionMargin;
boundingBox.Max.X += shapeTransform.Position.X + collisionMargin;
boundingBox.Max.Y += shapeTransform.Position.Y + collisionMargin;
boundingBox.Max.Z += shapeTransform.Position.Z + collisionMargin;
}