Syomus / ProceduralToolkit

Procedural generation library for Unity
https://assetstore.unity.com/packages/tools/utilities/procedural-toolkit-16508
MIT License
2.6k stars 225 forks source link

Mesh collider for low poly terrain? #32

Closed viveleroi closed 6 years ago

viveleroi commented 6 years ago

Experimenting with the low poly terrain example, I've added a mesh collider to the "TerrainGenerator" object, as well as a test player to the scene. It appears that the mesh collider is doing something, in that my player isn't falling infinitely, but it's clear that the mesh collider doesn't match the actual rendered "terrain" - my player is essentially up its head, as I walk around the terrain does vary in height, but I soon fall through.

I hoped you might have an idea what could be causing this before I go digging in and debugging.

viveleroi commented 6 years ago

Nevermind, I was able to figure out my issue. I'm not sure how my mesh collider was set to the mesh originally but after I re-created everything I realized that the mesh needed to be assigned to the collider just like the filter, so I temporary expanded ConfiguratorBase to use meshCollider.sharedMesh = mesh; and all is good.