|05 May 2003||#1|
Join Date: Apr 2003
Locking an axis for particles
Is there a way of locking particles in a specified direction? I want to run forces and collisions on a bunch of particles, but I want each particle to keep its creationtime z-axis position.
I was thinking of forcing it, probably something like my example below... but the results could be strange right? There is probably a much better way of doing this...
Add a initPositionPP attribute.
In the creation expression:
initPositionPP = worldPosition;
In the runtime expression:
vector $worldPosition = worldPosition;
vector $initPositionPP = initPositionPP;
float $posX = $worldPosition.x;
float $posY = $worldPosition.y;
float $posZ = $initPositionPP.z;
vector $newPosition = <<$posX, $posY, $posZ>>;
flockShape.position = $newPosition;
BTW, are runtime expressions executed after dynamics?
|05 May 2003||#2|
Join Date: Jan 2003
1) Make sure to set the Z components of acceleration and velocity to 0 as well, otherwise you may get glitches. Also, you might be better off setting the initial state attributes acceleration0, velocity0, and position0 to 0, 0, and your constant value as well.
2) There's an attribute on the particle object that is called "Expressions After Dynamics" in the channel box. I suspect that if you do all of the above the setting won't matter, but to be safe you should have your expression run after dynamics, which I think is NOT the default.
Mark R. Wilkins
author of MEL Scripting for Maya Animators
|01 January 2006||#3|
Join Date: Sep 2003
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.
Note that as CGTalk Members, you agree to the terms and conditions of using this website.
|Thread Closed share thread|