View Single Post
# 6 25-06-2003 , 06:07 PM
kbrown's Avatar
Moderator
Join Date: Sep 2002
Location: London, UK
Posts: 3,198
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!