View Full Version : Locking an axis for particles

05 May 2003, 07:09 PM
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, 08:09 PM
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

CGTalk Moderation
01 January 2006, 03:00 AM
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.