Skip to content

Commit ac86f84

Browse files
author
Dolu
committed
fix(CodeWalker.Core): fix MLO BBs calculation
Thanks to kirill-mapper: dexyfex#332
1 parent 485d56b commit ac86f84

File tree

1 file changed

+2
-3
lines changed

1 file changed

+2
-3
lines changed

CodeWalker.Core/GameFiles/MetaTypes/Archetype.cs

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -738,7 +738,7 @@ public void UpdateBBs(Archetype arch)
738738
{
739739
var earch = rooment.Archetype;
740740
var pos = rooment._CEntityDef.position;
741-
var ori = rooment._CEntityDef.rotation.ToQuaternion();
741+
var ori = Quaternion.Invert(rooment._CEntityDef.rotation.ToQuaternion());
742742
Vector3 abmin = earch.BBMin * rooment.Scale; //entity box
743743
Vector3 abmax = earch.BBMax * rooment.Scale;
744744
c[0] = abmin;
@@ -749,10 +749,9 @@ public void UpdateBBs(Archetype arch)
749749
c[5] = new Vector3(abmax.X, abmin.Y, abmax.Z);
750750
c[6] = new Vector3(abmax.X, abmax.Y, abmin.Z);
751751
c[7] = abmax;
752-
Vector3 center = (abmin + abmax) * 0.5f;
753752
for (int n = 0; n < 8; n++)
754753
{
755-
Vector3 corn = ori.Multiply(c[n] - center) + center + pos;
754+
Vector3 corn = ori.Multiply(c[n]) + pos;
756755
min = Vector3.Min(min, corn);
757756
max = Vector3.Max(max, corn);
758757
}

0 commit comments

Comments
 (0)