Makes generated mesh colliders compatible with SuperCharacterController (https://github.com/IronWarrior/SuperCharacterController)
#if UNITY_EDITOR | |
using UnityEngine; | |
using Sabresaurus.SabreCSG; | |
public static class BSPTreePostProcess | |
{ | |
[PostProcessCSGBuild] | |
public static void OnPostProcessCSGBuild(Transform meshGroup) | |
{ | |
if(meshGroup != null) | |
{ | |
// Grab all the built mesh colliders | |
MeshCollider[] colliders = meshGroup.GetComponentsInChildren<MeshCollider>(); | |
// Add a SuperCharacterController BSPTree to each collider | |
for (int i = 0; i < colliders.Length; i++) | |
{ | |
colliders[i].gameObject.AddComponent<BSPTree>(); | |
} | |
} | |
} | |
} | |
#endif |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment