mirror of
https://git.huckle.dev/Huckles-Minecraft-Archive/PCK-Studio.git
synced 2026-05-22 20:55:40 +00:00
21 lines
634 B
C#
21 lines
634 B
C#
using System;
|
|
using OMI.Formats.Model;
|
|
using System.Numerics;
|
|
|
|
namespace PckStudio.Core.Extensions
|
|
{
|
|
public static class ModelBoxExtension
|
|
{
|
|
public static BoundingBox GetBoundingBox(this ModelBox modelBox)
|
|
{
|
|
Vector3 halfSize = modelBox.Size / 2f;
|
|
Vector3 halfSizeInflated = new Vector3(modelBox.Inflate) + halfSize;
|
|
Vector3 transformedCenter = modelBox.Position + halfSize;
|
|
Vector3 start = transformedCenter - halfSizeInflated;
|
|
Vector3 end = transformedCenter + halfSizeInflated;
|
|
return new BoundingBox(start, end);
|
|
}
|
|
|
|
}
|
|
}
|