Community
3ds Max Modeling
Welcome to Autodesk’s 3ds Max Forums. Share your knowledge, ask questions, and explore popular 3ds Max modeling topics.
cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 

Move to Surface - stubborn objects

10 REPLIES 10
SOLVED
Reply
Message 1 of 11
Anonymous
3140 Views, 10 Replies

Move to Surface - stubborn objects

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:

 

 

 

Untitled2.png

 

 

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 Robot Happy

 

 

 

 

Tags (3)
10 REPLIES 10
Message 2 of 11
miledrizk
in reply to: Anonymous

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.

------------------------------------------------------
miledrizk@gmail.com
3DS Max 2021, V-Ray 5.2
3DS Max user since 2003 (3DS Max 7)
V-Ray user since 2008 (V-Ray 1.47)
My YouTube Channel http//www.youtube.com/c/MiledRizk
Message 3 of 11
Anonymous
in reply to: miledrizk

Thanks for the suggestion but it didn't do the trick unfortunately. I've resaved the model for 2017 though if you're willing to take a look? This is the script I've been using..

 

 

Cheers

Message 4 of 11
miledrizk
in reply to: Anonymous

I just opened the file and it seems all buildings are on the ground

 

But i will check the script anyway

 

1.PNG

------------------------------------------------------
miledrizk@gmail.com
3DS Max 2021, V-Ray 5.2
3DS Max user since 2003 (3DS Max 7)
V-Ray user since 2008 (V-Ray 1.47)
My YouTube Channel http//www.youtube.com/c/MiledRizk
Message 5 of 11
Anonymous
in reply to: miledrizk

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.. Robot Sad

Message 6 of 11
miledrizk
in reply to: Anonymous

ah ok,

 

And did you use the script Move To Surface or Scripted Glue to move them down?

------------------------------------------------------
miledrizk@gmail.com
3DS Max 2021, V-Ray 5.2
3DS Max user since 2003 (3DS Max 7)
V-Ray user since 2008 (V-Ray 1.47)
My YouTube Channel http//www.youtube.com/c/MiledRizk
Message 7 of 11
Anonymous
in reply to: miledrizk

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?

Message 8 of 11
miledrizk
in reply to: Anonymous

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

 

 

------------------------------------------------------
miledrizk@gmail.com
3DS Max 2021, V-Ray 5.2
3DS Max user since 2003 (3DS Max 7)
V-Ray user since 2008 (V-Ray 1.47)
My YouTube Channel http//www.youtube.com/c/MiledRizk
Message 9 of 11
Anonymous
in reply to: miledrizk

Amazing, it works! Thanks, really appreciate it Robot Very Happy

Message 10 of 11
miledrizk
in reply to: Anonymous

Welcome! 

Glad it worked! 🙂

------------------------------------------------------
miledrizk@gmail.com
3DS Max 2021, V-Ray 5.2
3DS Max user since 2003 (3DS Max 7)
V-Ray user since 2008 (V-Ray 1.47)
My YouTube Channel http//www.youtube.com/c/MiledRizk
Message 11 of 11
Anonymous
in reply to: Anonymous

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.

Post to forums  

Autodesk Design & Make Report