Search Unity

  1. Megacity Metro Demo now available. Download now.
    Dismiss Notice
  2. Unity support for visionOS is now available. Learn more in our blog post.
    Dismiss Notice

Copying just a terrain collider, without the data

Discussion in 'Scripting' started by Teedo145, Sep 5, 2015.

  1. Teedo145

    Teedo145

    Joined:
    Apr 14, 2014
    Posts:
    23
    I am creating a multiplayer procedurally generated world with multiple stitched together terrains. The world is too big to store in memory all at once so the client only loads those chunks around him. The server however will need to have every terrain collider and splat map in memory.

    Does anybody know if it's possible to just keep the terrain collider and delete the terrain data from memory? Or maybe create a mesh collider from the terrain collider?
    Every attempt at delete the terrain data from memory has stopped the collider from working.

    Thanks
     
  2. Kurt-Dekker

    Kurt-Dekker

    Joined:
    Mar 16, 2013
    Posts:
    38,517
    You might need to synthesize your own corresponding terrain collider (i.e., procedurally-generated mesh) based on what is in the terrain(s). Not sure.
     
  3. Kiwasi

    Kiwasi

    Joined:
    Dec 5, 2013
    Posts:
    16,860
    I don't think it can be done. A terrain collider isn't a real collider as such. It's inextricably linked with the terrain data.

    What exactly were you hoping to gain by having terrain colliders without terrain data? Maybe if you explain your use case we can provide an alternative.
     
  4. Teedo145

    Teedo145

    Joined:
    Apr 14, 2014
    Posts:
    23
    I am creating an online game with a dedicated authoritative server with about 200 max players. I want the terrain collider just for the collision detection for all the players on the server. Maybe I can just use a float array of the height map and ray cast to check if they are colliding with the ground instead.

    The game Rust has a large large map, does anyone know how they managed that?

    Edit: I just read that Rust isn't an authoritative server and collision is done client side, I guess that would mean they wouldn't need to load the world map into memory?
     
    Last edited: Sep 5, 2015
  5. Teedo145

    Teedo145

    Joined:
    Apr 14, 2014
    Posts:
    23
    Anyone? This is really bugging me, looks like I might have to go down the float array heightmap idea route.