[Closed] Help using maxscript with crowds
Hi guys,
Im having problems using maxscript with the crowds section of max.
What I am trying to do is create a flocking animation using crowds, I thought what I could do was set up a crowd system with a seek behaviour and a avoid behaviour.
This worked fine but then what i wanted to do was intergrate a script that after every frame moved the box that the crowd was seeking to the middle of the crowd. There is a option within the crowd modifier box called solve (just incase you dont know what im talking about!) in tht there is a maxscript option.
This maxscript option has a tick box ‘use maxscript’ which i ticked; and a function name box with a default ‘perframefn’ in it.
So basically what i have done is written a function using the default name: perframefn and then added this to the script. here it is:
fn perframefn b =
(
px=0; py =0; pz=0
for i in alldel do -- alldel is an array holding all the delagate objects
(
px+=i.pos.x
py+=i.pos.y
pz+=i.pos.z
)
pxx = px/(alldel.count)
pyy = py/(alldel.count)
pzz = pz/(alldel.count)
b.pos = [pxx,pyy,pzz]
)
perframefn $box01
I have tried loads of different options and cant seem to get it to work and there doesnt seem to be any examples online???
Can anybody help me??
Cheers.