SimplyMaya Forums

Welcome to the forum, feel free to ask questions here.

Home / forum / Animation / Mel Scripts & Programming / Particle replacing without instancing
Register FAQ Members List Calendar Mark Forums Read

New Thread
 
Thread Tools
Old 24-06-2003, 09:27 AM   #1
kbrown
Moderator
 
kbrown's Avatar
 
Join Date: Sep 2002
Location: London, UK
Posts: 3,198
Thanks: 0
Thanked 8 Times in 8 Posts
Default Particle replacing without instancing

Hi,

Does anyone know how to replace particles with some geometry without instancing. I'd like to have each replaced particle as a separate duplicate of an object which could then have their own dynamic (soft-body) secondary movement. I think this is not possible with Maya's particle instancer.
__________________
Kari
- My Website
- My IMDB

Do a lot, Fail a lot and Learn a lot!
kbrown is offline   Reply With Quote
Old 24-06-2003, 03:45 PM   #2
ragecgi
Super Moderator
 
ragecgi's Avatar
 
Join Date: Sep 2002
Location: Minnesota, USA
Posts: 3,709
Thanks: 0
Thanked 13 Times in 12 Posts
Default

You might have to do it via mel m8...

Sorry, not in front of Maya right now....

Danny in the mel section might have an idea or two for you regarding that.
__________________
Israel "Izzy" Long
Motion and Title Design for Broadcast-Film-DS
izzylong.com
ragecgi is offline   Reply With Quote
Old 24-06-2003, 05:16 PM   #3
kbrown
Moderator
 
kbrown's Avatar
 
Join Date: Sep 2002
Location: London, UK
Posts: 3,198
Thanks: 0
Thanked 8 Times in 8 Posts
Default

I already tried to do it with a per particle expression but I encountered a problem. I was thinking of duplicating the geometry in a creation expression, storing the duplicate's name in a per particle custom attribute and then deleting the duplicate when the particle dies. Then it would have been just a matter of moving the geometry in a runtime expression.

The problem is that you can only (?) have per particle custom attributes of float type meaning I can't store the name

Any ideas?

*edit*
Maybe I could rename every duplicate to something that includes the particle's Id in it's name but it wouldn't be fool proof...
__________________
Kari
- My Website
- My IMDB

Do a lot, Fail a lot and Learn a lot!

Last edited by kbrown : 24-06-2003 at 05:21 PM.
kbrown is offline   Reply With Quote
Old 25-06-2003, 12:46 PM   #4
kbrown
Moderator
 
kbrown's Avatar
 
Join Date: Sep 2002
Location: London, UK
Posts: 3,198
Thanks: 0
Thanked 8 Times in 8 Posts
Default

Moved. Let's try this here
__________________
Kari
- My Website
- My IMDB

Do a lot, Fail a lot and Learn a lot!
kbrown is offline   Reply With Quote
Old 25-06-2003, 01:13 PM   #5
mtmckinley
The Maya Mountain
 
mtmckinley's Avatar
 
Join Date: Aug 2002
Location: Seattle, WA
Posts: 8,245
Thanks: 1
Thanked 25 Times in 25 Posts
Default

I have no idea.
__________________
-Mike
www.mtmckinley.net
The Maya Toolbelt
mtmckinley is offline   Reply With Quote
Old 25-06-2003, 06:07 PM   #6
kbrown
Moderator
 
kbrown's Avatar
 
Join Date: Sep 2002
Location: London, UK
Posts: 3,198
Thanks: 0
Thanked 8 Times in 8 Posts
Default

Well, I got it working with an ugly hack :p If someone can figure out a more sophisticated method I'd be really appreciated.

Here's what I did:
For the per particle creation expression I wrote:
Code:
string $sDupName = ("dup" + particle1Shape.particleId);
string $sNewObj[] = `duplicate nurbsSphere1`;
rename $sNewObj[0] $sDupName;
In the per particle runtime expression I wrote:
Code:
string $sDupName = ("dup" + particle1Shape.particleId);
if(particle1Shape.age >= particle1Shape.lifespan)
	delete $sDupName;
else
{
	vector $vPos = particle1Shape.position;
	setAttr ($sDupName + ".tx") ($vPos.x);
	setAttr ($sDupName + ".ty") ($vPos.y);
	setAttr ($sDupName + ".tz") ($vPos.z);
}
Finally I wrote an expression that deletes all the duplicates when the animation is at start:
Code:
if(frame == 0)
{
	if(`objExists "dup*"`)
		delete "dup*";
}
As I said earlier, this is not a fool proof method because I'm relying on object names. Works for the purpose I need right now though...
__________________
Kari
- My Website
- My IMDB

Do a lot, Fail a lot and Learn a lot!
kbrown is offline   Reply With Quote
Old 25-06-2003, 06:36 PM   #7
ragecgi
Super Moderator
 
ragecgi's Avatar
 
Join Date: Sep 2002
Location: Minnesota, USA
Posts: 3,709
Thanks: 0
Thanked 13 Times in 12 Posts
Default

Great hack m8!

I'll keep looking for another way for you tho
__________________
Israel "Izzy" Long
Motion and Title Design for Broadcast-Film-DS
izzylong.com
ragecgi is offline   Reply With Quote
Old 05-11-2003, 06:15 PM   #8
Dann
Registered User
 
Dann's Avatar
 
Join Date: Feb 2003
Location: Los Angeles
Posts: 695
Thanks: 0
Thanked 2 Times in 2 Posts
Default

Quick question... I'm trying to use this trick, but it doesn't seem to use the scale and rotational information that's in my particle system. How could I adapt the following so that the duplicate gets made with the scale and rotational information?

particleShape1.scalePP = rand(.08,.4);
particleShape1.rotPP = rand(0,360);
string $sDupName = ("dup" + particleShape1.particleId);
string $sNewObj[] = `duplicate target_plane`;
rename $sNewObj[0] $sDupName;

Thanks.

figured it out. I should stop posting, because half the time I figure it out before people get a chance to reply.

Last edited by Dann : 05-11-2003 at 07:02 PM.
Dann is offline   Reply With Quote
New Thread

« Previous Thread | Next Thread »

Thread Tools

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

1 Month

$34

Month-to-month billing
$34/month
Unlimited access to all videos
Project files to download
Easy to cancel at anytime
 
 

3 months

$87

Billing every 3 months
$29/month
Unlimited access to all videos
Project files to download
Easy to cancel at anytime
Save $5 per month or $15 in total compared to monthly billing with this package.

12 months

$288

Billing every 12 months
$24/month
Unlimited access to all videos
Project files to download
Easy to cancel at anytime
Save $10 per month or $120 in total compared to monthly billing with this package.

Your plan will automatically renew. You can cancel at any time via your PayPal account to avoid being charged again.

You can view the FAQ on our video plans here. You can contact us directly here. By clicking one of the buttons above, you agree to our Terms and Privacy Policy.