Locking an axis for particles

Become a member of the CGSociety

Connect, Share, and Learn with our Large Growing CG Art Community. It's Free!

Thread Tools Search this Thread Display Modes
  05 May 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
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
Mark R. Wilkins
author of MEL Scripting for Maya Animators
  01 January 2006
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.
CGTalk Policy/Legalities
Note that as CGTalk Members, you agree to the terms and conditions of using this website.
Thread Closed share thread

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
Society of Digital Artists

Powered by vBulletin
Copyright 2000 - 2006,
Jelsoft Enterprises Ltd.
Minimize Ads
Forum Jump

All times are GMT. The time now is 02:13 PM.

Powered by vBulletin
Copyright ©2000 - 2018, Jelsoft Enterprises Ltd.