mirror of
https://git.huckle.dev/Huckles-Minecraft-Archive/PCK-Studio.git
synced 2026-05-22 14:55:58 +00:00
Move Common functionality to Core project & rendering and Model support as well
This commit is contained in:
20
PckStudio.Core/Extensions/ModelBoxExtension.cs
Normal file
20
PckStudio.Core/Extensions/ModelBoxExtension.cs
Normal file
@@ -0,0 +1,20 @@
|
||||
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);
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user