Search Unity

  1. Welcome to the Unity Forums! Please take the time to read our Code of Conduct to familiarize yourself with the forum rules and how to post constructively.
  2. We have updated the language to the Editor Terms based on feedback from our employees and community. Learn more.
    Dismiss Notice

How do i add terrain collider to my randomly generated terrain?

Discussion in 'Scripting' started by owlthesheep3, Nov 1, 2019.

  1. owlthesheep3

    owlthesheep3

    Joined:
    May 13, 2019
    Posts:
    35
    Im making infinite terrain based game but when i always want to try it my player just falls through the terrain, so i need somehow to add terrain collider to the terrain via script. Can somebody help me with that? thx
     
  2. Pavlon

    Pavlon

    Joined:
    Apr 15, 2015
    Posts:
    191
  3. owlthesheep3

    owlthesheep3

    Joined:
    May 13, 2019
    Posts:
    35
  4. Pavlon

    Pavlon

    Joined:
    Apr 15, 2015
    Posts:
    191
    Just add a meshcollider to each chunk and every time you update a chunk also update its meshcollider.
    Same way you do it with the meshfilter.