Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Help  Terrain Distance Field collisions
#1
I have a medium sizedĀ terrain (128 width, 128 length, 600 height) that I'd like to get cloth collisions working with. (The main character in my game has a gown that drags along the ground behind her.)

I've attached an ObiCollider to the terrain object, which works fine - but the framerate suffers a bit. So I decided to try using a distance field instead: I used a tool to create a mesh from the terrain data, used that mesh to generate a distance field, and then assigned the distance field to the ObiCollider that sits on the terrain. (The terrain is still a proper Unity Terrain object - the mesh was just an intermediate object).

Performance is better, but the collisions produced by the distance field are pretty bad - at rest, the gown sits visibly above the ground, and gets far more bunched up, wrinkled, and rumpled.

I've attached two screenshots, one using the distance field and one not. (Argh - why does theĀ forum limit these to 100kb each ?!?!?)

NOT using a distance field:
   

USING a distance field:
   

Is what I'm doing a bad idea, for some reason - or am I misconfiguring something?
Reply
#2
What are your distance field generation settings? You can set the minimum error for the distance field, and the maximum depth of its node tree. This will affect the accuracy of the distance field, a too large error threshold can result in too conservative distance estimates (the offset seen in your picture)
Reply