Search Unity

  1. Unity support for visionOS is now available. Learn more in our blog post.
    Dismiss Notice

Question Enabing/Disabling Terrains

Discussion in 'Getting Started' started by tleylan, Sep 24, 2023.

  1. tleylan

    tleylan

    Joined:
    Jun 17, 2020
    Posts:
    601
    I've gotten it to work but mostly it seems by luck not by design. I have a terrain (let's say a park) that I want to disable enabling another terrain in exactly the same place but not the park. I have it so the players remained on the other terrain but I've made a few mods (I'm introducing a 3rd alternative terrain) and now the players fall through the ground.

    I have to assume the terrain collider is what everyone is standing on. I made the assumption that the terrains can be at exactly the same position. I've tried enabling the 2nd terrain before disabling the 1st terrain but that doesn't appear to make a difference.

    Is this a "frame" problem such at for a moment there is no collider active for the players to stand on? Regardless is there a way to swap terrain colliders? I'm trying to get it so I can switch out the park for other "scenery". And as I've said, I had it working but not solidly it seems.
     
  2. adamgolden

    adamgolden

    Joined:
    Jun 17, 2019
    Posts:
    1,548
  3. tleylan

    tleylan

    Joined:
    Jun 17, 2020
    Posts:
    601
    Interesting. I will eventually test it but I don't believe that is the issue. I wasn't doing it before and this is an entirely different GO not changing anything that should puzzle a transform. One thing I eventually worked out was that the collider on a terrain is necessarily warped right? It matches the surface of the terrain at least in part. I can see the "terrain" itself is quite low in the scene but the park sits considerably above that spot.

    I also don't understand terrain position and scale. It is positioned in the world and has a scale of 1, 1, 1. I added a plane to my second object and the positions are incredibly offset and I have to enlarge the plane. It looks like a ration of 25 to 1.

    The transform position may be my doing. Some time back I wanted the center of the terrain to be about the center of the park so I could coordinate where things were. That may have been a dumb idea.
     
  4. tleylan

    tleylan

    Joined:
    Jun 17, 2020
    Posts:
    601
    I was working on the idea that if I copied the park terrain collider into another game object I could switch it. That worked well but now that I think about it that is because the terrain is identical. If I form a new terrain it won't match at all. Hmm, one idea is to make the players teleport upwards a bit, change the terrain and they might settle down onto the new go collider. I have it back to being able to switch the go. This BTW permitted me to "turn off the park" while everyone was still standing in the same place essentially making the ground vanish. At least it is back to how it used to work :)