how they did the bricks animation effect here?

Become a member of the CGSociety

Connect, Share, and Learn with our Large Growing CG Art Community. It's Free!

Thread Tools Search this Thread Display Modes
Old 05 May 2010   #16
Originally Posted by StevieMac: Anyone got an idea of how to do this in PFlow Vanilla?

Birth your particles in a brick pattern and use a find target plus script vector.

Event01 Birth + related operators + Script Operator (pCont.particleVector = pCont.particlePosition)

Event 02 Position Object to place your particles someplace else other than their birth location then use a Find Target (set to Script Vector) to set them back in their original positions.
poof ~>Vimeo<~
Old 05 May 2010   #17
Thanks Jonny.
Thats not far off from what I was trying but now
I don't know how to get each brick to work it's way up to create the wall.
I can't work out how to store the rotation/orentation & Scale to an array & how to bring it back.

I've attatched the Max 2010 file.

Attached Files
File Type: zip (29.9 KB, 15 views)
Old 05 May 2010   #18
Ahh dude your so close you can taste it, all you ready need to do is store the original orientation so you have something to feed the Go To Rotation Test operator. I attached your scene with a couple small changes.
Attached Files
File Type: zip (40.5 KB, 35 views)
poof ~>Vimeo<~
Old 05 May 2010   #19
Ah man you're right I was pretty close this always happens when I'm doing Max code, I get nearly there then go round in circles trying to find the right solution! Thanks mate.

So you stored the rotation in row 1 of a matrix? Can I do the same for the scale then but in row 2?

Any idea how to get the wall to build up from the bottom? I'm guessing I'd need to use/store a particle id for each brick then recall that back in an order that starts from the bottom. I think there was a tut like this on Bobo's script show DVD but I don't think it explained how to assign an id to a specific object.

Thanks for the help mate/guys.
Old 05 May 2010   #20
Yes you can store scale data in row2, you can store any matrix data in any open row if you like.

For something like you are doing the original brick wall would have to be created in order, some of the brick in it are out of order. If you want it to build from the bottom up the easiest way is you brick01 be the last brick on the top of the wall and the first brick should be numbered the last brick created.

So if you build your wall from brick99 (being the first brick in the bottom row) to brick01 (being the last brick on the top row) it should work correctly

You can sort you array using something like this: (someone else may know a better way to do it)

 on Init pCont do 
 	Global sortedBricks = #()
 	Global Brickwall = $Brick_* as array
 	brickOrderName = for o in Brickwall collect
 	sort brickOrderName
 	sortedBricks = for i in brickOrderName where isValidNode (obj = getNodeByName i) collect obj

Attached a sample of what I mean
Attached Files
File Type: zip (31.2 KB, 15 views)
poof ~>Vimeo<~
Old 05 May 2010   #21
Hey thanks Jonny. I get what you mean but it'll take me a bit to understand all the code properly. I'll have a go at storing the scale in the matrix row 2, then when I've got that sorted I'll post it back up soon hopefully.

Thanks for the help mate, it means a lot when someone listerns.
Old 05 May 2010   #22
No problem, basically the above script does what your did except it organizes the objects. It grabs the objects names (collect, organizes them in ascending order (with the 'sort' function), then re-assigns the actual object back to its name (isValidNode + getNodeByName).

So now your *Bricks_ array instead of being something like 1,7,45,2,3,78 will be 1,2,3,4,5,6,7, with a new name sortedBricksArray. Now since it is in order your particles will be processed in the order that you want which is ascending or descending and not random.

If you want to know more about matrices grab Bobos "The Matrix Explained", since everything in pflow is built on loops, vectors, matrices, and arrays for the most part. Actually the whole script set is awesome TBH.
poof ~>Vimeo<~

Last edited by JohnnyRandom : 05 May 2010 at 09:07 PM.
Old 05 May 2010   #23
Ok I tried storeing the Scale in the matrix row2 but without any luck. I thought it would be as simple as adding
pCont.useScale = true
to the begining &
scale = pCont.getParticleScale i
TM.row2 = scale

Then recal this in the second script
pCont.particlescale = (pCont.particleTM).row2

So now all the bricks go to one point so somehow I don't think I'm recalling the scale correctly but I can't work out where I'm going wrong. I've skipped through the Max Script help & noticed you used a Matrix3 1 is this the right matrix to use now i'm adding more than one row of data?

I also went through the DVD's you sudgested but I still couldn't find a point where Bobo saved the Scale in a Matrix & recalled it but I probably didn't reconise where he used it.

Thanks peeps
Old 05 May 2010   #24
Ok, i guess it really depends on how you want to treat your scale. So for instance if you were to add a scale operator to the second event and only adjust the variation... random number how about 73% (constrained for the sake of simplicity, which will be a single float value instead of 3 float values) This will generate some nice scale variation between the bricks.

Now in the final Go To Rotation event, just return the particles scale back to normal. You can make them grow back by setting up a simple if/then (albeit it is kind of slow) like this:

on Proceed pCont do
	count = pCont.numParticles()
	for i in 1 to count do
		pCont.particleIndex = i
		if pCont.particleNew do
			pCont.particleOrientation = (pCont.particleTM).row1
		if pCont.particleScale < 1.0 then
			curScale = pCont.particleScale
			pCont.particleScale = curScale + 0.01
		if pCont.particleScale > 1.0 then
			curScale = pCont.particleScale
			pCont.particleScale = curScale - 0.01

This feeds the Go To Rotation test with the stored orientation value from earlier when the particle arrives in the event. Then it checks to see it the particle scale is larger or smaller than 1.0 it will adjust the particle scale until it reaches 1.0.
Attached Files
File Type: zip (26.7 KB, 27 views)
poof ~>Vimeo<~
Old 05 May 2010   #25
Thread automatically closed

This thread has been automatically closed as it remained inactive for 12 months. If you wish to continue the discussion, please create a new thread in the appropriate forum.
CGTalk Policy/Legalities
Note that as CGTalk Members, you agree to the terms and conditions of using this website.
Thread Closed share thread

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Society of Digital Artists

Powered by vBulletin
Copyright 2000 - 2006,
Jelsoft Enterprises Ltd.
Minimize Ads
Forum Jump

All times are GMT. The time now is 05:28 PM.

Powered by vBulletin
Copyright ©2000 - 2017, Jelsoft Enterprises Ltd.