Positioning particles

Become a member of the CGSociety

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

THREAD CLOSED
 
Thread Tools Search this Thread Display Modes
Old 04 April 2013   #1
Positioning particles

Hello,

Does anybody know how to position particles made from a groups objects in the exact same position they were in with the group object?

I know I can do this by setting the 'Position object' operator to pivot and then changing the pivot location of all the groups objects to be the same as the groups pivot but this means that when I want to rotate the particles they all rotate around the groups pivot and not their own local centered pivot, which is what I need them to do.

Any ideas would be much appreciated.

Thanks for any help here.

Spencer
__________________
Spencer Carpenter
Freelance 3D Artist
www.spencercarpenter.co.uk
spencer@spencercarpenter.co.uk
 
Old 04 April 2013   #2
I'm no expert but this works for me.

add a script operator to your flow and replace the code with this:


on ChannelsUsed pCont do
(
    pCont.useAge = true
    pCont.useTM = true
    pCont.useShape = true
	pCont.useMapping = true
	pCont.useMtlIndex = true
)

on Init pCont do 
(
    global ChunksArray = Geometry as array
)

on Proceed pCont do 
(
    t = pCont.getTimeStart() as float

    if t < 0 do 
    (
        NumChunks = ChunksArray.count
		curTime = pCont.getTimeEnd()
		dum = at time curTime $'PF Source 001'
        for i = 1 to NumChunks do
        (
			dum.pos
            pCont.AddParticle()
            pCont.particleIndex = pCont.NumParticles() 
            pCont.particleAge = 0
            pCont.particleTM = ChunksArray[i].transform
            pCont.particleShape = ChunksArray[i].mesh
			pCont.setMtlIndexForAllParticles 1
        )
    )
)

on Release pCont do 
(

)


You may have to evaluate ChunksArray before you start (not sure why). Again, I am no expert but this did the trick for me.
__________________
www.davetyner.com
 
Old 04 April 2013   #3
Thanks for that. Sorry but where do I put this in the event? Do I need to replace the position object operator with it? What else needs to be in the event in terms of operators for this to work at a basic level?

Thanks again

Spencefr
__________________
Spencer Carpenter
Freelance 3D Artist
www.spencercarpenter.co.uk
spencer@spencercarpenter.co.uk
 
Old 04 April 2013   #4
Here is the scene. I tested both a birth operator and script operator. Both evaluate OK. You should just be able to scrub the timeline and see the result.

Download Scene
__________________
www.davetyner.com

Last edited by em3 : 04 April 2013 at 05:10 PM. Reason: saved as max 2012 file
 
Old 04 April 2013   #5
Hey thanks for the scene file!

Also, sorry one more thing.

How do I evaluate chunksarray I've tried typing the following into the listener but none worked:

eval $chunksarray
evaluate $chunksarray
eval chunksarray
evaluate chunksarray

Thanks again

Spencer
__________________
Spencer Carpenter
Freelance 3D Artist
www.spencercarpenter.co.uk
spencer@spencercarpenter.co.uk

Last edited by Snape : 04 April 2013 at 05:10 PM.
 
Old 04 April 2013   #6
ChunksArray gets initialized in the "on init pCont do" section of the script.

Geometry as array is going to take all your scene geo and add it to an array. You may want to seperate by layer, or call by wildcard (ie $frags_*) if you only want specific geo included in you ChunkArray
__________________
poof ~>Vimeo<~

Last edited by JohnnyRandom : 04 April 2013 at 05:19 PM.
 
Old 04 April 2013   #7
Originally Posted by Snape: Hey thanks for the scene file!

Also, sorry one more thing.

How do I evaluate chunksarray I've tried typing the following into the listener but none worked:

eval $chunksarray
evaluate $chunksarray
eval chunksarray
evaluate chunksarray

Thanks again

Spencer


from the help file...


 Evaluate All (CTRL+E)- like in the legacy editor, this command will evaluate the whole script loaded in the current tab.
 Evaluate Line / Selection (CTRL+ENTER)-like in the legacy editor and the Listener, this command will evaluate the current line or selection. Pressing CTRL+ENTER is equivalent to pressing the NumPad Enter key which can be used alternatively.


http://docs.autodesk.com/3DSMAX/15/...Number=d30e4303

or just type

global ChunksArray = Geometry as array
in the listener and press the numpad Enter key

but really, you should just have to open up the script operator script and press CTRL+E
__________________
www.davetyner.com
 
Old 04 April 2013   #8
Oh ok so the script does the evaluating and there's no need to do it manually then..?
__________________
Spencer Carpenter
Freelance 3D Artist
www.spencercarpenter.co.uk
spencer@spencercarpenter.co.uk
 
Old 04 April 2013   #9
Originally Posted by JohnnyRandom: ChunksArray gets initialized in the "on init pCont do" section of the script.


Yes, this happens. For some reason when I was first trying this I got errors at this part of the script so as part of the debug I would evaluate outside the script. Newbs...what are you gonna do? :P
__________________
www.davetyner.com
 
Old 04 April 2013   #10
Sorry I should have just replied instead of editing my post:

Originally Posted by JohnnyRandom: "Geometry as array" is going to take all your scene geo and add it to an array. You may want to seperate by layer, or call by wildcard (ie $frags_*) if you only want specific geo included in you ChunkArray


meaning something like:

global chunksArray = $frags_* as array
__________________
poof ~>Vimeo<~
 
Old 04 April 2013   #11
OK got it, thanks a million guys!!
__________________
Spencer Carpenter
Freelance 3D Artist
www.spencercarpenter.co.uk
spencer@spencercarpenter.co.uk
 
Old 04 April 2013   #12
np

If you want to validate what you are collecting you can run a simple script like this in the listener:


chunksArray = $frags_* as array
for i in 1 to chunksArray.count do format "% - %\n" i chunksArray[i]


or it doesn't "really" have to be chucnksArray to test it


a = $frags_* as array
for i in 1 to a.count do format "% - %\n" i a[i]


This will return the counts and all the objects in the collection.
__________________
poof ~>Vimeo<~
 
Old 04 April 2013   #13
Me again!

Just to check that I'm taking the best approach can I explain what I'm doing?...

This is for a projection mapping job. I have divided up the set (imagine a wall for arguments sake) into small diamonds.

Now I want to make those diamonds spin and scale when an object goes near it whether it be the surface of a rectangular cuboid or a point helper.

What approach would you take (I have attached the file incase it helps [edit:the file is too big to attach ]).
__________________
Spencer Carpenter
Freelance 3D Artist
www.spencercarpenter.co.uk
spencer@spencercarpenter.co.uk

Last edited by Snape : 04 April 2013 at 06:19 PM.
 
Old 04 April 2013   #14
I would think so but I am partial to particles

This is how I would go about it:
__________________
poof ~>Vimeo<~
 
Old 04 April 2013   #15
That's great thanks very much. Would this work in conjunction with the script for positioning the group particles above (since you've used a cube shape)?
__________________
Spencer Carpenter
Freelance 3D Artist
www.spencercarpenter.co.uk
spencer@spencercarpenter.co.uk
 
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
CGSociety
Society of Digital Artists
www.cgsociety.org

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

All times are GMT. The time now is 07:17 AM.


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