Search Unity

Feedback Best deformable terrain collider

Discussion in 'Physics' started by crysicle, Aug 23, 2019.

  1. crysicle

    crysicle

    Joined:
    Oct 24, 2018
    Posts:
    72
    Hello, i'm making a terraformation system which manipulates millions of heightmaps on the terrain each frame and am looking for the best method to update physics. Thus far the only options i've seen are the mesh collider and the terrain collider.

    Assigning new vertices to the mesh and letting the mesh collider rebake CollisionData is the most limitting as i hit about 2ms per 1k vertices manipulated on the high end. Using the terrain collider and updating it through SetHeights() is more efficient by about a factor of 7-8 making that about 2ms per 7k-8k heights manipulated. Both of these methods do their calculations on the main thread, however, further limitting the amount of possible data you can update for physics.

    Does anyone have any idea how to crank more performance out of these methods or perhaps a different idea alltogether?

    Here's a vid of the system in motion. Ideally Im looking to synchronize about 50000 verts/heights per 2ms. Having that much wouldn't make me create all kinds of workarounds and limitations for my project.