-
Notifications
You must be signed in to change notification settings - Fork 241
Description
kOS Bounds is based on iterating over these MeshFilters:
Part.GetComponentsInChildren<MeshFilter>();
But it turns out MeshFilters are all the Rendering shapes, not all the collider shapes. Generally the same algorithm could be used but have it iterate over the part's colliders rather than its MeshFilters, i.e. these:
Part.GetComponentsInChildren<Colllider>();
Using the MeshFilters causes these three issues:
- It causes issue BOUNDS returns wrong values when Waterfall mod is installed. #2905 with the Waterfall mod (which I will close and redirect here).
- Because the rendered mesh is typically more high-res than the collider, there's a discrepancy between the answers. The collider is the one that physically matters so it's the one kOS should return.
- Because the rendered mesh is typically more high-res than the collider, using the collider will give it fewer vertices to iterate over, making the algorithm less expensive.
Ignore triggers
IMPORTANT: When using Colliders, bypass any that have Collider.isTrigger == true. Those don't count as a real physical object (the physics engine does not make it hit things, it passes right though things). A trigger is a special case sort of collider that merely fires off a callback hook when it touches things, so the programmer can react to that callback in whatever arbitrary way. An example of where this is used in KSP is the invisible collider spheres around robot scanner arms in the Breaking Ground DLC. Those colliders are "trigger" colliders and ignoring them will prevent them from falsifying the bounds.