Need a script for a box animation

Hi friends i am new to this Maxscript thing some time back saw a video on youtube
http://www.youtube.com/watch?v=_55J5kHKkUI

i am really impressed by this i just want a small script through which i can create a given number of boxes t diferent pos and also want a simple script which achieves the effect in the video this only to undertstand the script and learn plz help me

Comments

Comment viewing options

Select your preferred way to display the comments and click "Save settings" to activate your changes.
Anubis's picture

Ok, post your code and

Ok, post your code and dependent questions in a new topic to get help from more people. I'll also try to help you.

my recent MAXScripts RSS (archive here)

Anubis's picture

Hi Sdinesh86, i just upload

Hi Sdinesh86, i just upload 2 scripts to my website, take a look

my recent MAXScripts RSS (archive here)

sdinesh86's picture

Thanks for that anubiss i

Thanks for that anubiss

i was wondering i f you can help me with some script for shader's i am writing some basic scripts just dont know if that is correct way to do it and also cannot solve some problems that i face

right now i am working on writing script for a simple wireframe shader

i will post that code soon

Marco Brunetta's picture

From the youTube page, it

From the youTube page, it seems like the animation in the video is based on Conway´s game of life, not on randomly selected boxes.

Still it's a pretty clear script, and the extensive comments are a big plus.

Anubis's picture

There no comes into my mind

There no comes into my mind some special book which I would recommend you, maybe every one is good to somewhere. My primary learning source is the max help reference, also read other scripts and not use 'em as is, but i try to make my own.

Sorry about the shaders, i havn't. I am happy that you are interested about animating scripts. Of course I have but they are snippets like and to be more user friendly and useful for more people, must be modified first. This requires time so be patient. Now you can see my already uploaded scripts here by clicking on my user name.

my recent MAXScripts RSS (archive here)

sdinesh86's picture

Dude thnx for sych a great

Dude thnx for sych a great help.

thnx for those comments too it helped me learn more without breaking mu head a lot can i ask you another favour if you dont mind

can you post some of your scripts that you did in the same fashion so that i can learn them in better way have you done some shaders if ues can you post that too or suggest me a book which i can refer to learn maxscript

dude you hae been a great help for me

i will write my own script based on the one that you send and will upload it

Anubis's picture

First, welcome to Scriptspot

First, welcome to Scriptspot and to MAXScript!
And there is what i write to you:

-------------------
-- SETUP
-------------------
-- 1/ function to resize the boxes
-- you can use also "scale" but see and this metod
fn cube obj size =
(obj.length = obj.width = obj.height = size)
-- 2/ function to collect the boxes as array
theBoxes = #()
fn theArray = (theBoxes = selection as array)
-- 3/ set large enough animation range
animationRange = interval 0 2000 -- 2000.0/30 = 66.6667 sec.
-------------------
-- CREATION
-------------------
-- create array of boxes (6 * 6 * 6), total = 216
b = box() -- create box
select b -- select it
cube $ 10 -- resize it calling "cube" function
-- copy it 5 times and move by X
-- if to say you want distance between them to be 1
-- end use above size value 10, then use 11
for i = 1 to 5 do
(
	c = copy b -- copy
	c.pos.x += i * 11 -- move 11 by X
	selectMore c -- append to selection
)
theArray() -- collect selection
-- now the same as above but copy all 6 boxes and move them by Y
for i = 1 to 5 do
( -- as you see in inside loop FOR i use "j" instead of "i" to avoid conflict
	for j in theBoxes do
	(
		c = copy j
		c.pos.y += i * 11
		selectMore c
	)
)
theArray()
-- now the same as above but copy all 36 boxes and move them by Z
for i = 1 to 5 do
(
	for j in theBoxes do
	(
		c = copy j
		c.pos.z += i * 11
		selectMore c
	)
)
theArray()
theBoxes.wirecolor = green -- change wirecolor to green
-------------------
-- ANIMATION
-------------------
-- first SETUP once to make into animation
select theBoxes -- if not selected, but should be
animate on
	at time 100
		cube theBoxes 0
-- END SETUP intro here
-------------------------------------------
-- the CORE Animation Part -----------
for t in 200 to 2000 by 200 do
(
	at time t
	(
		sliderTime = t -- move slider
		clearSelection() -- clear selection
		-- and make new random selection:
		for i in 1 to (random 1 theBoxes.count) do
		(selectMore theBoxes[random 1 theBoxes.count])
		animate on
			cube $ 10 -- grow
	)
	at time (t += 100)
	(
		sliderTime = t -- move slider
		animate on
			cube $ 0 -- scale down the same selection
	)
)
-- Well Done! The real Happy End is here :))
-- Happy scripting!
-- Regards, Anubis

Here is preview result:
http://www.youtube.com/watch?v=8tThXcB_4do

my recent MAXScripts RSS (archive here)

Comment viewing options

Select your preferred way to display the comments and click "Save settings" to activate your changes.