CGTalk > Software > Autodesk Maya > Maya Programming
Login register
Thread Closed share thread « Previous Thread | Next Thread »  
Thread Tools Search this Thread Display Modes
Old 05-07-2003, 07:09 PM   #1
New Member
Join Date: Apr 2003
Posts: 13
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?
Old 05-07-2003, 08:09 PM   #2
mark_wilkins's Avatar
Join Date: Jan 2003
Posts: 1,339
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
Old 01-15-2006, 03:00 AM   #3
CGTalk Moderation
CGTalk Forum Leader
Join Date: Sep 2003
Posts: 1,066,478
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

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

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 09:01 PM.

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