[Closed] an idea for script
maybe this isn’t the best place for this,
but i’ve used another program that would allow me to drop objects, via a single hotkey, down until they met/ran into another object.
but this program, the models all had pretty much had collision objects on them, so im not sure how doable this would be in max.
but it would be very useful, i could line up, say, boxes manually over a plane where i wanted them to be, the grab the group and they would drop down at the plane.
maybe even using the pivot location on an object as well.
This in essence is already done, as it is an example in the Maxscript help files,
How To > Move Objects to a Surface
macroscript MoveToSurface category: "HowTo"
(
fn g_filter o = superclassof o == Geometryclass
fn find_intersection z_node node_to_z =
(
local testRay = ray node_to_z.pos [0,0,-1]
local nodeMaxZ = z_node.max.z
testRay.pos.z = nodeMaxZ + 0.0001 * abs nodeMaxZ
intersectRay z_node testRay
)
on isEnabled return selection.count > 0
on Execute do
(
target_mesh = pickObject message:"Pick Target Surface:" filter:g_filter
if isValidNode target_mesh then
(
undo "MoveToSurface" on
(
for i inselection do
(
int_point = find_intersection target_mesh i
if int_point != undefined then i.pos = int_point.pos
)--end i loop
)--end undo
)--end if
)--end execute
)--end script
Hope it helps.
says nested macroscripts definitions are not permitted,
points to the first line.
im using 2014 if that helps.
Either way im glad to know its so noobish they felt like using it for a learning exercise. :wise:
I think you are trying to drag the code to a new button …
You should either open the script in editor and evaluate it, then look for it in the ‘howto’ category in customize UI dialog, to assign it to hotkey or toolbar.