BlackWhite

11-07-2010, 05:41 PM

Hi everyone!

I really need your help about something in Maxscript...

What I want to do is launch a ray from each point helper generated by an 3D array and look if the rays intersect the box named "box01". My problem is: I dont know how to use in loop all point helper position as origin for a ray and then if the ray intersect the box affect its size.

Thank you very much!

Alex

This is the script I did /////////////////////

Box length:22 width:38 height:48 pos:[13,32,0]

(

local array = #()

c = 20

global l = 6

global w = 6

global h = 4

ML = (c * L + c) / 2

MW = (c * W + c) / 2

MH = (c * H + c) / 2

for x = 1 to l do

(

array[x]=#()

for y = 1 to w do

(

array[x][y]=#()

for z = 1 to h do

(

array[x][y][z]=Point size:1 pos:[((x*c)-ml),((y*c)-mw),((z*c)-c)] wirecolor:[255,255,255]

)

)

)

(

for i in (getClassInstances point) do

(

r0 = Ray i.pos [100,150,150] -- Ray [pos] [dir]

IR = intersectRay $box01 r0

(

if IR != undefined do

(

i.size = i.size+2

)

)

)

)

)

I really need your help about something in Maxscript...

What I want to do is launch a ray from each point helper generated by an 3D array and look if the rays intersect the box named "box01". My problem is: I dont know how to use in loop all point helper position as origin for a ray and then if the ray intersect the box affect its size.

Thank you very much!

Alex

This is the script I did /////////////////////

Box length:22 width:38 height:48 pos:[13,32,0]

(

local array = #()

c = 20

global l = 6

global w = 6

global h = 4

ML = (c * L + c) / 2

MW = (c * W + c) / 2

MH = (c * H + c) / 2

for x = 1 to l do

(

array[x]=#()

for y = 1 to w do

(

array[x][y]=#()

for z = 1 to h do

(

array[x][y][z]=Point size:1 pos:[((x*c)-ml),((y*c)-mw),((z*c)-c)] wirecolor:[255,255,255]

)

)

)

(

for i in (getClassInstances point) do

(

r0 = Ray i.pos [100,150,150] -- Ray [pos] [dir]

IR = intersectRay $box01 r0

(

if IR != undefined do

(

i.size = i.size+2

)

)

)

)

)