I've been trying to solve this for a while and now the clock is catching up to me so I hope someone here can help.
I'm working on a large city model, the model contains thousands of buildings and a 3D terrain mesh. I want to move the buildings to the surface of the terrain so they all align to the mesh but whatever I try (short of manually aligning them all one by one), I can't quite get it to work.. So far I've tried a couple of scripts from scriptspot - Move to Surface and Scripted Glue but both yield the same result - I select all the buildings, apply the script, some buildings align to the terrain but most don't move at all. Here's a screen grab of the end result:
I can only assume that there is something broken/different about the objects that refuse to move but I can't figure out what it might be. A copy of the model can be downloaded here.
Many thanks
Solved! Go to Solution.
I've been trying to solve this for a while and now the clock is catching up to me so I hope someone here can help.
I'm working on a large city model, the model contains thousands of buildings and a 3D terrain mesh. I want to move the buildings to the surface of the terrain so they all align to the mesh but whatever I try (short of manually aligning them all one by one), I can't quite get it to work.. So far I've tried a couple of scripts from scriptspot - Move to Surface and Scripted Glue but both yield the same result - I select all the buildings, apply the script, some buildings align to the terrain but most don't move at all. Here's a screen grab of the end result:
I can only assume that there is something broken/different about the objects that refuse to move but I can't figure out what it might be. A copy of the model can be downloaded here.
Many thanks
Solved! Go to Solution.
Solved by miledrizk. Go to Solution.
Hi,
I couldn't open the file because i have max 2017,
But maybe there is a problem with the pivot points of those buildings,
It's possible that they are outside the boundary of the terrain or below its surface, etc,...
Anyway, to check if this is the case select all the buildings and go to Hierarchy panel,
Click Affect Pivot Only and press the Center To Object, then click Affect Pivot Only to turn it off,
And try the scripts.
Note: the buildings should be separate objects not in a group or something(even though some scripts may consider
this situation, but its better to keep them as separate objects)
Also, in case the pivot point trick worked, the buildings might go half way in the ground in case those
script are made in a way that move the objects starting from their pivot points. But in that case it can be solved
easily by a three of 4 lines of a script i can write.
Hi,
I couldn't open the file because i have max 2017,
But maybe there is a problem with the pivot points of those buildings,
It's possible that they are outside the boundary of the terrain or below its surface, etc,...
Anyway, to check if this is the case select all the buildings and go to Hierarchy panel,
Click Affect Pivot Only and press the Center To Object, then click Affect Pivot Only to turn it off,
And try the scripts.
Note: the buildings should be separate objects not in a group or something(even though some scripts may consider
this situation, but its better to keep them as separate objects)
Also, in case the pivot point trick worked, the buildings might go half way in the ground in case those
script are made in a way that move the objects starting from their pivot points. But in that case it can be solved
easily by a three of 4 lines of a script i can write.
I just opened the file and it seems all buildings are on the ground
But i will check the script anyway
I just opened the file and it seems all buildings are on the ground
But i will check the script anyway
Ah yes, they are roughly aligned but if you know where to look there are many buildings sitting just above or going through the terrain..
Ah yes, they are roughly aligned but if you know where to look there are many buildings sitting just above or going through the terrain..
ah ok,
And did you use the script Move To Surface or Scripted Glue to move them down?
ah ok,
And did you use the script Move To Surface or Scripted Glue to move them down?
Neither script seems to work on this so I just manually lowered them down for now.. If you move the terrain down then try one of the scripts you can see the problem?
Neither script seems to work on this so I just manually lowered them down for now.. If you move the terrain down then try one of the scripts you can see the problem?
Here is the Move To Surface script,
I added two lines of code that will do the trick,
The problem was in the pivot points of the buildings, like what i expected in the first Post.
Those two lines i added, will move the pivot point of each object to the bottom center
https://drive.google.com/file/d/16h6X4czyyriEFYFOwmxF2jlSzJn5T5JU/view?usp=sharing
Here is the Move To Surface script,
I added two lines of code that will do the trick,
The problem was in the pivot points of the buildings, like what i expected in the first Post.
Those two lines i added, will move the pivot point of each object to the bottom center
https://drive.google.com/file/d/16h6X4czyyriEFYFOwmxF2jlSzJn5T5JU/view?usp=sharing
Amazing, it works! Thanks, really appreciate it
Amazing, it works! Thanks, really appreciate it
Welcome!
Glad it worked! 🙂
Welcome!
Glad it worked! 🙂
I came across this topic which tackles exactly what I'm trying to do. All Objects have different z-Values and I would like to move them on a surface or z zero value.
Thanks a lot for sharing the script. I'm not at all experienced with script and somehow I can't manage to make it work. Still after doing it step by step with the pivot points. Has someone an input?
I'd really appreciate.
The model is here: https://polybox.ethz.ch/index.php/s/P5DQEdC8QodAbod
I came across this topic which tackles exactly what I'm trying to do. All Objects have different z-Values and I would like to move them on a surface or z zero value.
Thanks a lot for sharing the script. I'm not at all experienced with script and somehow I can't manage to make it work. Still after doing it step by step with the pivot points. Has someone an input?
I'd really appreciate.
The model is here: https://polybox.ethz.ch/index.php/s/P5DQEdC8QodAbod
Can't find what you're looking for? Ask the community or share your knowledge.