Updating the terrain collider after importing raw data
I have 7 identical terrains that get loaded seperately (they are populated with different texturea and foliage to show different times of the year) I had to adjust the actual shape of the terrain, but wanted to keep all the texturing work.
I altered ONE terrain, how I wanted it, exported the RAW terrain data from the setting menu,, then imported it into all my 6 other scenes terrain.
THIS WORKED GREAT!
However, I needed to re-make some of my NPC waypoint paths. so I started that job.. but the points WERE NOT conforming to the new terrain...
Now I realise they are conforming to THE OLD terrain--- YES I have copied that data into the collider slot!
HERES THE QUESTION! How can I throw away the old terrain data, and update it to what actually exists!
Thanks
This still seems to be a problem. Would be nice if there was a one-click editor way to generate new terrain data based off of the actual terrain object.
Answer by markfrancombe · May 24, 2016 at 09:06 PM
YES! @gecko The trick is realise that there isa top level terrain component (what you are trying to change) BUT there is a secret sneaky version below that. To get to that. Click the little tiny menu in the top right above the component and select DEBUG. The usual terrain editing features disappears but you get a new slot for terrain data. So for example, to make "some change" to a copy of a terrain without losing the original. 1. copy your component 2. hit debug 3. select the terrain data slot and duplicate that with new name. 4. open new component under debug, and drag in the new copy 5. turn debug off in both
Now you should be able to edit either without the other being affected.
Mark
Hmm.. now I think about it... this might not be the solution... grrr... damn what did I do??+ sorry... something like this however...
Answer by gecko · May 24, 2016 at 08:50 PM
@markfrancombe - Did you ever solve this? I'm having the same problem in 4.7.
Answer by Acreates · May 17, 2017 at 03:06 AM
The visual part of my terrain does not match up to my collision, any way to get them to align again?
Answer by Darkgaze · Mar 26, 2019 at 11:17 AM
For anybody looking for help, to update the TerrainCollider you have to update the heights on the terraindata of both the terrainCollider and the terrain. Seems like there is a copy. Changing the terrain only will update the visualization but not the collider itself.
terrainCollider.terrainData.setHeights(...)
terrain.terrainData.setHeights(...)
In v2019 the terrain has been moved to GPU and the API changed, so maybe this doesn't work. Seems like there is a function to update "dirty" data.