object cloning with offset to selection
This is a bit Maxscript 101, but I cant seem to get it to work. Let's say you have 5 boxes (copies or instances) in a selection, I am looking to create a new clone object (sphere) offset in the -z direction. I have been looking online and at the maxscript help but cant get it to work as I want.
This is what I have so far. Any help would be much appreciated!
for i in selection do
(
nl = sphere radius:3
newObj = maxOps.cloneNodes nl cloneType:#instance newNodes:i #nodialog
nl.pos = i.pos
nl.pos.z = nl.pos.z - 10
)
Comments
.
Tools and Scripts for Autodesk 3dsMax
Hi Miauu, Thank you for that.
Hi Miauu,
Thank you for that. I thought I was very close :)
Just one quick question. Do you know why it creates an instance at 0,0,0 also. There is nothing in my selection at that location, but it still seems to create an instance object at that point?
.
Because this line:
nl = sphere radius:3
creates a sphere at 0,0,0 no matter if you use my code or yours. Then, in the for loop the script cretes an instance below each box object.
This will creates new sphere below the boxes, without creating a sphere at 0,0,0
This will create instances:
Tools and Scripts for Autodesk 3dsMax
Miauu, Thank you so much.
Miauu,
Thank you so much. Very much appreciated!!