Search Unity

Unity Terrain and Objects loop.

Discussion in 'Editor & General Support' started by Vintage_Green, Sep 22, 2015.

  1. Vintage_Green

    Vintage_Green

    Joined:
    Mar 27, 2015
    Posts:
    22
    Hello. Is there an existing plugin addon or simple way to accomplish a looping single terrain where the hills and rocks and objects seemlessly loop over and over upon itself. Image below is what I'm thinking.


     
  2. Ryiah

    Ryiah

    Joined:
    Oct 11, 2012
    Posts:
    21,128
  3. Kiwasi

    Kiwasi

    Joined:
    Dec 5, 2013
    Posts:
    16,860
    I've played with that one before. It's not bad and could be adapted fairly easily to this project. Note that it works by moving the terrain around the player, and uses nine terrains to achieve this. This may cause havoc depending on your intended looping behaviour.
     
  4. Ryiah

    Ryiah

    Joined:
    Oct 11, 2012
    Posts:
    21,128
    It might kill performance on mobile too.
     
    QFSW and Kiwasi like this.
  5. CaoMengde777

    CaoMengde777

    Joined:
    Nov 5, 2013
    Posts:
    813
    fairly simple, like boredmormon said, use 9 terrains (maybe more if you want.. depending on view distance .. 9 is all thats Really needed, depends on your design i guess)

    when player crosses the tile to next row, you make backrow become front row

    pseudocode
    if(playerPos >= tileBorderPos)
    {
    row of tiles pos = pos infront/inback of middle row of tiles
    }

     
    Kiwasi likes this.
  6. Vintage_Green

    Vintage_Green

    Joined:
    Mar 27, 2015
    Posts:
    22
    Thanks for the advise everyone I've tried this plugin above, however everytime I get to a border it freezes up for a few seconds. Most likely this is from moving entire terrain tiles over from one side to the next. I really don't want it to freeze like that everytime as it would ruin the effect I'm going for. But I highly doubt there is anyway of doing this where it wont freeze when moving the Terrain tiles. I wonder how Suimono Does their infinite Water, I do know it keeps track of the camera not just a player object tho.

    1000x1000 size terrain with speed trees and rocks and other objects needs to be looped seamlessly no freeze or stutter.
     
  7. Vintage_Green

    Vintage_Green

    Joined:
    Mar 27, 2015
    Posts:
    22
    After Further Testing I have found the hang or freeze when going from one terrain section to another was actually being caused by the speedtrees. I'm now using trees from the BIG environment pack and rocks and grass got it down to 30 fps even to test this and no freeze. It seems the speedtrees don't like to be moved around in real-time even when only 40-100 of them in the scene at 120 fps it will still freeze. Guess I will stick with basic trees for this game.

    Edit-

    I just realized that the rocks wont duplicate/move with each terrain(clone) There is hitboxes of the rocks on the ground but it wont transfer the actual rocks mesh object. So basically if I leave the main Terrain patch all of the rocks become invisible.

    Edit2-

    Ok the rocks by default were set to Static I turned off static for the Terrain and the Rocks and they now work just fine.
     
    Last edited: Sep 23, 2015