Notifications
Clear all

[Closed] Drop selection to ground plane?

Is there an easy way to have the current selection of objects be dropped to the ground plane (zero Z), while keeping the relative position of the objects to each other? Basically using the bounding box of the selection to move all selected objects up or down, unteil either the lowest or highest point of the selection touches the ground plane?

2 Replies

hi

this is doable in the UI by grouping everything togeter and using the snap to grid option. If you want to do it via a script the general idea of the code would be

get the min and max z of the world space bounding boxes of all objects in the selection with

nodeGetBoundingBox YOUROBJECT (matrix3 1)

if currentObjzMin < zmin
(
zMin = currentObjzMin
)

and same for zMax

then loop over each node an move them up or down by the zMin/zMax
You will have to abs or negate them depending on which way your moving them and wheather they are above or below 0 in the Z

hope that helps
good luck

Thanks! My scripting skills are basically non-existant, but I’ll try to cobble more of it together