I’m writing my own colliders for a fluid system. The designers add many colliders to nested gameobjects in the hierarchy so a prefab has like 20-30 colliders sometimes. But after many of those objects its unable to keep up with the performance, because when calculating the collision each fluid particle is checked against each collider.
So I made another component, BoundingBox to the parent of the prefab, so that first bounding boxes are checked against the fluid particles, then only the children colliders of the bounding boxes will be calculated for collision. I need to be able to get all children entities recursively with CustomCollider component on it from the root entity with BoundingBox, inside a job. How would I achieve this?
That’s what I tried first, I passed root entity and NativeList to my GetChildrenRecursive method inside the job, but it wouldn’t let me add to the list since the it was an IJobParallelFor job because I was looping for each fluid particle. I might be doing this wrong since I’m pretty new to this stuff, so any advice is appreciated.
How would I go with writing my own GameObjectConversionSystem? I mostly just use the ConversionSystem passed to me from the Convert method.
That’ll work too. IConvertGameObjectToEntity is a MonoBehaviour, so you can do MonoBehaviour things like iterate through all the children recursively and fetch all the CustomColliderAuthoring that way.