Search Unity

TerrainCollider hole implementation

Discussion in 'Physics for ECS' started by snacktime, Nov 30, 2019.

  1. snacktime

    snacktime

    Joined:
    Apr 15, 2013
    Posts:
    3,356
    Curious what direction you guys were thinking of for handling holes.

    The first idea I had was a custom collector. But really filtering on the quad seems like the common use case here. And collectors don't support additional filtering in a generic way that I can see. And I'm not sure it would have other uses outside of terrain if they did.

    Another approach seems to be maintain a holes array that you can index into like heights. Maybe a bit packed byte array to reduce the size. So far this seems to me like the best option. Keeps it all encapsulated in the terrain logic and would be fairly straight forward to implement.
     
  2. snacktime

    snacktime

    Joined:
    Apr 15, 2013
    Posts:
    3,356
    Actually you could just encode holes into the heights themselves by using the min or max values to indicate it's a hole. As long as you make the heights array itself private so that logic is completely internal otherwise that would trip people up.
     
    Last edited: Nov 30, 2019