Notifications
Clear all

[Closed] maxscript to create multiple objects between two object

hi, i have two object Box a and Box b , i want to create multiple box at particular distance between two boxes(Box a & Box b) using maxscript, Please Help

2 Replies

pointTarget1 and pointTarget2 == any Point3


fn fnRepositionObj repositionObj pointTarget1 pointTarget2 Division direction  =
(
        for i = 0 to Division do
        (
            copyObj = copy repositionObj
            
            calcXPerc = (pointTarget1.pos.x - pointTarget2.pos.x)/Division
            calcYPerc = (pointTarget1.pos.y - pointTarget2.pos.y)/Division
            calcZPerc = (pointTarget1.pos.z - pointTarget2.pos.z)/Division
                    
            copyObj.pos.x = pointTarget1.pos.x - calcXPerc*direction*i
            copyObj.pos.y = pointTarget1.pos.y - calcYPerc*direction*i
            copyObj.pos.z = pointTarget1.pos.z - calcZPerc*direction*i
        )
)

fnRepositionObj $box $point1 $point2 10 1


Thanks a Lot @freemanprof, I checked script and it working, i just made a little change to make script small…


fn fnRepositionObj repositionObj pointTarget1 pointTarget2 Division direction  =
(
        for i = 0 to Division do
        (
            copyObj = copy repositionObj
         
            calcPerc = (pointTarget1.pos - pointTarget2.pos)/Division           

            copyObj.pos = pointTarget1.pos - calcPerc*direction*i       
        )
)
fnRepositionObj $Box001 $point001 $point002 10 1