Landscape modeling (height map applied to position of objects)

Hi dear community,

I am quite new to Blender and the community, although I spend extensive time on a online search, I can only find tutorials on “How to create a landscape with the displacement modifier” - but as I want to also place objects in the landscape - it would be nice to know if there is a method to adapt the Z axis position of (other) object according to a height map?

Before I start to write a Python script to do this, I would like to get some input of more experienced people…

So basically the script (I am about to start writing) would do:

  • Landscape: Blender mesh (referenced by name)
  • ObjectGroup: Blender group of meshes (referenced by group name)
    Loop for each object:
  1. curPos: Get current position of object (local origin in global coordinate system)
  2. curHeight: sample the height the landscape object from the positive Z axis (on the x/y position curPos)
  3. If no hit - continue
  4. change the Z-axis on the position of the curPos to curHeight
    Loop end

This should move all objects in the group to be resting on the surface of the landscape (provided that the origin point of the object is on the base of the object).

Is there already a script like that ?
Is the approach total crap ?

I would really appreciate any feedback. Thank you very much!


Guess, this one might be close enough:

Perfect! Thank you very much!