11 November 2003, 05:04 AM
either a volume shape or use max distance(and attenuation) will do that, not sure how to implement it in mel though.
11 November 2003, 04:35 PM
I can't use any fields, though I guess what I am trying to do is create a custom field. Perhaps there is a way to simulate the max distance and attenuation attributes on a null object. Anyone have any ideas?
11 November 2003, 06:09 PM
Using the above senario I tried this script as a runtime expression, it is kinda like Level of Detail script, but modified:
]float $particleVec = `getAttr particleShape.position`;
string $locatorV = `spaceLocator -p`;
float $locatorX = `getAttr ($locatorV + ".tx")`;
float $locatorY = `getAttr ($locatorV + ".ty")`;
float $locatorZ = `getAttr ($locatorV + ".tz")`;
vector $locatorVec = <<$locatorX, $locatorY, $locatorZ>>;
//subtract the particle position and the locator vectors and take the
//magnitude of the resulting vector.
float $dist = mag($particleVec - $locatorVec);
int $threshold = 5;
//If the particle is less than 5 units from the locator change its direction
//If the particle is greater than 5 units from the locator assume normal direction
if ($dist< $threshold)
particleShape1.position = rot(position, <<0,0,1>>, -.01);
if ($dist > $threshold)
particleShape1.position = rot(position, <<0,1,0>>, -.001);
I get an error though when it hits this line:
]float $dist = mag($particleVec - $locatorVec);
// Error: float $dist = mag($particleVec - $locatorVec); //
// Error: Illegal operation "-" on data of type float. //]
Also creation of the locator takes place outside of the expression but I included it to make sense where the variable came from . Later I will randomize the location of the locator in space.
01 January 2006, 05:00 PM
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.