CGTalk > Software Specific Forums > Autodesk Maya > Maya Dynamics
Login register
Thread Closed share thread « Previous Thread | Next Thread »  
 
Thread Tools Search this Thread Display Modes
Old 08-14-2009, 11:30 PM   #1
chrispy2001
Veteran
Christopher Phillips
Zoic Studios
Canada
 
Join Date: Dec 2004
Posts: 62
finding the position of particles bounding box

Is it possible to find out the centre position of the bounding box for a particle shape?

I have a swarm of particles moving all over the place using goals and i want to attach a volume axis field that will always sit in the "averaged" centre of the particles.
 
Old 08-15-2009, 12:22 AM   #2
Wick3dParticle
Technically an artist
 
Wick3dParticle's Avatar
portfolio
Ilan Gabai
FX TD
Blue Sky Studios
New York, USA
 
Join Date: Jul 2005
Posts: 743
Send a message via AIM to Wick3dParticle
Hey Chrispy,

This may help point you in the right direction.
So it has to be a runtime expression, because your particles are always moving.
Now to get the bounding box data you can run something like this:


Code:
float $bBox[] = `exactWorldBoundingBox particleShape1`; vector $bBoxCenter = <<($bBox[0] + $bBox[3])/2, ($bBox[1] + $bBox[4])/2, ($bBox[2] + $bBox[5])/2>>; particleShape1.theCenterX = $bBoxCenter.x; particleShape1.theCenterY = $bBoxCenter.y; particleShape1.theCenterZ = $bBoxCenter.z;


then create an expression on your field like this:


Code:
yourField.translateX = particleShape1.theCenterX; yourField.translateY = particleShape1.theCenterY; yourField.translateZ = particleShape1.theCenterZ;



Its fairly easy to set up from here, let us know how it goes.

good luck.

~Ilan


EDIT:
Actually I just remembered another way to get the center:

Code:
getAttr particle1.center;


Then follow the other steps described above.
__________________
my amazing tumblr

Last edited by Wick3dParticle : 08-15-2009 at 12:38 AM.
 
Old 08-15-2009, 01:06 AM   #3
chrispy2001
Veteran
Christopher Phillips
Zoic Studios
Canada
 
Join Date: Dec 2004
Posts: 62
that's brilliant and works like a dream

thanks Ilan
 
Old 08-15-2009, 01:06 AM   #4
CGTalk Moderation
Lord of the posts
CGTalk Forum Leader
 
Join Date: Sep 2003
Posts: 1,066,481
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


Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

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 04:39 AM.


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