diff --git a/CodeWalker.Core/GameFiles/FileTypes/YmapFile.cs b/CodeWalker.Core/GameFiles/FileTypes/YmapFile.cs index 5107fec..43ea40e 100644 --- a/CodeWalker.Core/GameFiles/FileTypes/YmapFile.cs +++ b/CodeWalker.Core/GameFiles/FileTypes/YmapFile.cs @@ -1475,11 +1475,10 @@ namespace CodeWalker.GameFiles BSRadius = Archetype.BSRadius * Math.Max(Scale.X, Scale.Z); if (Orientation == Quaternion.Identity) { - BBMin = (Archetype.BBMin * Scale) + Position; - BBMax = (Archetype.BBMax * Scale) + Position; + BBMin = (Vector3.Min(Archetype.BBMin, Archetype.BBMax) * Scale) + Position; + BBMax = (Vector3.Max(Archetype.BBMin, Archetype.BBMax) * Scale) + Position; BBCenter = (BBMax + BBMin) * 0.5f; BBExtent = (BBMax - BBMin) * 0.5f; - BBExtent = BBExtent.Abs(); } else { @@ -1492,7 +1491,7 @@ namespace CodeWalker.GameFiles var bbcenter = (Archetype.BBMax + Archetype.BBMin) * 0.5f; var bbextent = (Archetype.BBMax - Archetype.BBMin) * 0.5f; var ncenter = Vector3.TransformCoordinate(bbcenter, mat); - var nextent = Vector3.TransformNormal(bbextent, matabs); + var nextent = Vector3.TransformNormal(bbextent, matabs).Abs(); BBCenter = ncenter; BBExtent = nextent; BBMin = ncenter - nextent; diff --git a/Rendering/Renderer.cs b/Rendering/Renderer.cs index 9747c5b..3e45b8d 100644 --- a/Rendering/Renderer.cs +++ b/Rendering/Renderer.cs @@ -3651,7 +3651,7 @@ namespace CodeWalker.Rendering foreach (var kvp in RootEntities) { var ent = kvp.Key; - if (EntityVisibleAtMaxLodLevel(ent) && EntityVisible(ent)) + if (EntityVisibleAtMaxLodLevel(ent)) { ent.Distance = MapViewEnabled ? MapViewDist : (ent.Position - Position).Length(); if (ent.Distance <= (ent.LodDist * LodDistMult)) @@ -3676,7 +3676,7 @@ namespace CodeWalker.Rendering } else { - if ((ent.Parent == null) || EntityVisible(ent)) + if (EntityVisible(ent)) { VisibleLeaves.Add(ent); }