Log in

View Full Version : Cybersonics 103 Animation Teaser...


reisser
15-02-2004, 13:16
on ChannelsUsed pCont do
(
pCont.useTime = true
pCont.useInteger = true
pCont.usePosition = true
pCont.useSpeed = true
)

on Init pCont do
(
count = pCont.NumParticles()

--random targets
for i in 1 to count do
(
pCont.particleIndex = i
pCont.particleInteger = random 0 23
)
)

on Proceed pCont do
(
count = pCont.NumParticles()

for i in 1 to count do
(
pCont.particleIndex = i

--determine distance from origin (correct straying particles)
point = pCont.particlePosition
dist = sqrt ((point.x * point.x) + (point.y * point.y))
dist = sqrt ((dist * dist) + (point.z * point.z))

--adjust stray particles
if dist > 50 then
(
if point.x > 0 then
pCont.particlePosition.x = pCont.particlePosition.x - .25
else
pCont.particlePosition.x = pCont.particlePosition.x + .25

if point.y > 0 then
pCont.particlePosition.y = pCont.particlePosition.y - .25
else
pCont.particlePosition.y = pCont.particlePosition.y + .25

if point.z > 0 then
pCont.particlePosition.z = pCont.particlePosition.z - .25
else
pCont.particlePosition.z = pCont.particlePosition.z + .25
)

--set target position
sel = execute("$conn_target_" + pCont.particleInteger as string + ".pos")

--find vector of separation
vect = sel - pCont.particlePosition

--set target finding
pCont.particleSpeed = vect / 1000

--success test, is particle considerably close to target?
if ((vect.x > -4) and (vect.x < 4)) and ((vect.y > -4) and (vect.y < 4)) and ((vect.z > -4) and (vect.z < 4)) then
(
--choose new target at random
old = pCont.particleInteger
do
(
num = random 0 23
if not (old == num) then
new = true
)
while new = false
pCont.particleInteger = num
--store position
pos = pCont.particlePosition

--spawn new on success
pCont.AddParticle()
pCont.particleIndex = pCont.NumParticles()
pCont.particlePosition = pos
do
(
num = random 0 23
if not (old == num) then
new = true
)
while new = false
pCont.particleInteger = num
)
)
)

on Release pCont do
(

)

Tom Bottiglieri
15-02-2004, 13:36
*scratches head* what?

av11d
15-02-2004, 16:25
HOLY WOW THAT'S AWESOME.

... but what does it do...? lol

Lev
15-02-2004, 17:15
So.... why use maxscript when you could do most of this with Particle Flow system? Or am i missing something?

Koko Ed
15-02-2004, 17:41
on ChannelsUsed pCont do
(
pCont.useTime = true
pCont.useInteger = true
pCont.usePosition = true
pCont.useSpeed = true
)

on Init pCont do
(
count = pCont.NumParticles()

--random targets
for i in 1 to count do
(
pCont.particleIndex = i
pCont.particleInteger = random 0 23
)
)

on Proceed pCont do
(
count = pCont.NumParticles()

for i in 1 to count do
(
pCont.particleIndex = i

--determine distance from origin (correct straying particles)
point = pCont.particlePosition
dist = sqrt ((point.x * point.x) + (point.y * point.y))
dist = sqrt ((dist * dist) + (point.z * point.z))

--adjust stray particles
if dist > 50 then
(
if point.x > 0 then
pCont.particlePosition.x = pCont.particlePosition.x - .25
else
pCont.particlePosition.x = pCont.particlePosition.x + .25

if point.y > 0 then
pCont.particlePosition.y = pCont.particlePosition.y - .25
else
pCont.particlePosition.y = pCont.particlePosition.y + .25

if point.z > 0 then
pCont.particlePosition.z = pCont.particlePosition.z - .25
else
pCont.particlePosition.z = pCont.particlePosition.z + .25
)

--set target position
sel = execute("$conn_target_" + pCont.particleInteger as string + ".pos")

--find vector of separation
vect = sel - pCont.particlePosition

--set target finding
pCont.particleSpeed = vect / 1000

--success test, is particle considerably close to target?
if ((vect.x > -4) and (vect.x < 4)) and ((vect.y > -4) and (vect.y < 4)) and ((vect.z > -4) and (vect.z < 4)) then
(
--choose new target at random
old = pCont.particleInteger
do
(
num = random 0 23
if not (old == num) then
new = true
)
while new = false
pCont.particleInteger = num
--store position
pos = pCont.particlePosition

--spawn new on success
pCont.AddParticle()
pCont.particleIndex = pCont.NumParticles()
pCont.particlePosition = pos
do
(
num = random 0 23
if not (old == num) then
new = true
)
while new = false
pCont.particleInteger = num
)
)
)

on Release pCont do
(

)
What the...?

Ryan Dognaux
15-02-2004, 21:50
Whatever it is, I bet it's awesome... :]

Tyler Olds
15-02-2004, 23:57
So.... why use maxscript when you could do most of this with Particle Flow system? Or am i missing something?

i agree with Lev, what is the special secret? Or are you just trying out the max script?

reisser
16-02-2004, 22:31
MAXscript allows for recurring transformations to occur when you want them to (like when an object nears a target). There are just some things that are really inefficient using the graphical system. That is the nature of a GUI.

This is just an ambigous way of posting the main focus of our storyline without giving it away yet. Hope everyone is doing well and on track for the fast approaching deadline.

av11d
16-02-2004, 22:36
Hey! Don't bash the GUI :-P

I liked your animation a lot last year and this year it looks like it will be awesome again. Deadlines... oh boy.

Team 75 is attending both the PA and NJ regionals, so I'll see you there! Later.

Lev
16-02-2004, 23:10
MAXscript allows for recurring transformations to occur when you want them to (like when an object nears a target). There are just some things that are really inefficient using the graphical system. That is the nature of a GUI.

This is just an ambigous way of posting the main focus of our storyline without giving it away yet. Hope everyone is doing well and on track for the fast approaching deadline.

Particle Flow system allows you to have complex procedural behaviors, including finding target and checking for distance - all through GUI ;)

reisser
16-02-2004, 23:15
Make a scene. Have particles chase a target. Once successful, have them chase another target at random in the scene. Do that without a script and with one event. I want to know how!

Lev
17-02-2004, 00:10
Make a scene. Have particles chase a target. Once successful, have them chase another target at random in the scene. Do that without a script and with one event. I want to know how!

I would, but right now im too busy with our animation. I'm not sure what exactly you mean by "one event", but YES, i can make such scene with a single particle system, controlled from one place. Particle Flow is the best addition in 3dsmax6, after mental ray.

Baden3DMAX13
18-02-2004, 14:05
It depends how you set it up in the event manager as to how well it would work, but i bet if you do it right it would work within the GUI, but scripting seems easier then taking the time and testing them out. Good job with the script, did you do it through tutorial??? or was it all purely thought up with a bit of inspiration????

reisser
18-02-2004, 14:40
No tutorial. Just the reference file and the index.

Lev
18-02-2004, 20:25
Make a scene. Have particles chase a target. Once successful, have them chase another target at random in the scene. Do that without a script and with one event. I want to know how!

Just finished the scene. Took about 3 minutes to set up, and 5 to tune the settings. no scripting, one particle system.

Here is the scene file: http://web.mit.edu/~levpopov/Public/particles/particleflow.max
Here is the rendered sequence (30sec - 11mb, sorry): http://web.mit.edu/~levpopov/Public/particles/particleflow.avi


Particle Flow systems are awesome.

reisser
18-02-2004, 22:22
Whoa. Perhaps i stand very corrected. Nice work. I will look at the scene ASAP (no max at home).

-Brandon