SabreCSG
SabreCSG copied to clipboard
Collision brushes just don't generate collision meshes.
I've been getting complaints of the clipping on one of my windows not working in a level, and decided to investigate. Not sure what the SabreCSG version is, but it's relatively recent (downloaded within the last couple of months).
I have disabled every other CSG object and brush other than shown.
The brushes:
The generated geometry:
As you can see, some of the brushes are being turned into collision meshes correctly, but the ones on the right are just skipped. No errors are thrown. I have tried deleting and remaking the brushes from the ones on the left that work. I know the Rebuild button is working because I've tried deleting the CollisionMesh
object and it gets remade.
Bluntly, I'm completely stumped, and really think this may be a bug not user error. And if it's not, it's probably a UX failure if the user has literally no way of telling what the issue is.
Hey Sniggyfigbat,
a quick suggestion, because I remember encountering a similar issue with CSG Models that contain only collision brushes... just add one regular brush. See if that fixes everything after a force rebuild.
@Henry00IS Good suggestion, but unfortunately no dice.
Hmm. Turning on the experimental 'Optimize Geometry' setting throws the following error:
NullReferenceException: Object reference not set to an instance of an object
Sabresaurus.SabreCSG.Optimizer.CalculateConvexHulls (System.Collections.Generic.List`1[T] polygons) (at Assets/IntruderMM/SabreCSG/Scripts/Core/BuildEngine/Optimizer.cs:253)
Sabresaurus.SabreCSG.BrushCache.OptimizeCollision (Sabresaurus.SabreCSG.BrushCache mainCache) (at Assets/IntruderMM/SabreCSG/Scripts/Core/BuildEngine/BrushCache.cs:554)
Sabresaurus.SabreCSG.CSGFactory.CoreBuild (System.Object state) (at Assets/IntruderMM/SabreCSG/Scripts/Core/BuildEngine/CSGFactory.cs:430)
Sabresaurus.SabreCSG.CSGFactory.Build (System.Collections.Generic.List`1[T] brushes, Sabresaurus.SabreCSG.CSGBuildSettings buildSettings, Sabresaurus.SabreCSG.CSGBuildContext+BuildContext buildContext, UnityEngine.Transform rootTransform, Sabresaurus.SabreCSG.MaterialMeshDictionary materialMeshDictionary, System.Collections.Generic.List`1[T] collisionMeshDictionary, System.Boolean polygonsRemoved, System.Boolean forceRebuild, System.Action`1[T] onProgressChange, System.Action`2[T1,T2] onFinalizeVisualMesh, System.Action`2[T1,T2] onFinalizeCollisionMesh, System.Boolean multithreaded) (at Assets/IntruderMM/SabreCSG/Scripts/Core/BuildEngine/CSGFactory.cs:100)
Sabresaurus.SabreCSG.CSGModelBase.Build (System.Boolean forceRebuild, System.Boolean buildInBackground) (at Assets/IntruderMM/SabreCSG/Scripts/CSGModelBase.cs:234)
Sabresaurus.SabreCSG.CSGModel.Build (System.Boolean forceRebuild, System.Boolean buildInBackground) (at Assets/IntruderMM/SabreCSG/Scripts/CSGModel.cs:234)
Sabresaurus.SabreCSG.Toolbar.OnBottomToolbarGUI (System.Int32 windowID) (at Assets/IntruderMM/SabreCSG/Scripts/UI/Toolbar.cs:570)
UnityEngine.GUILayout+LayoutedWindow.DoWindow (System.Int32 windowID) (at <e958c94af49b432dad15fe9d47da0d11>:0)
UnityEngine.GUI.CallWindowDelegate (UnityEngine.GUI+WindowFunction func, System.Int32 id, System.Int32 instanceID, UnityEngine.GUISkin _skin, System.Int32 forceRect, System.Single width, System.Single height, UnityEngine.GUIStyle style) (at <e958c94af49b432dad15fe9d47da0d11>:0)
UnityEngine.GUIUtility:ProcessEvent(Int32, IntPtr, Boolean&)
Dunno' if that's in any way relevant.
I can reproduce the issue. Adding a regular brush at the end tends to fix one of them, that's what I remembered. Clearly something is horribly broken.
Aha, progress:
Adding meshes with visual geometry forces generation of the missing colliders if (and only if) they intersect the missing colliders.
Notes:
- Adding entirely new brushes using the Draw tool, and setting them to collision-only, still results in them being skipped.
- Changing the order of the brushes inside their parent object has no effect. Neither does shifting them up one layer of the hierarchy. Neither did forming them into a CSG group.
Shitty workaround: Put all collision brushes in a dedicated CSG object, set them all as visible, Force Rebuild, and them manually delete the created MaterialMesh
object.
Out of interest, did this problem ever get fixed?
Out of interest, did this problem ever get fixed?
nope, have the exact same issue currently