MEL set attr. but only Z

Become a member of the CGSociety

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

THREAD CLOSED
 
Thread Tools Search this Thread Display Modes
Old 03 March 2013   #1
MEL set attr. but only Z

Hi there,

i want to change the z rotation of a particle. But i want to keep the X,Y rotation of each particle as it is.

when i use the following expression:

particle2_grassShape.rotationPP = <<0,0,rand(0,360)>>;


i change the X,Y value to 0, which is not, what i want. But i don´t know, how i can change only the Z value.

any hints?
thank you!
__________________
www.mackevision.com
 
Old 03 March 2013   #2
I think you can do this

vector $rot = particle2_grassShape.rotationPP;
particle2_grassShape.rotationPP = <<$rot.x,$rot.y,rand(0,360)>>;

David
__________________
http://www.djx.com.au
 
Old 03 March 2013   #3
thank you for your help. sadly, it doesn´t work, even with a new particle system. Do i anything wrong?

Thank you!!!
__________________
www.mackevision.com
 
Old 03 March 2013   #4
Particles need some special calls, so the best is you use the particle/nParticle command and then query or edit the attributes. You cant change the values relatively, so if you add something on top you need to query the values first:

float $r[] = `particle -attribute rotationPP -id 123 -query particleShape1`;
particle -edit -attribute "rotationPP" -id 123 -vectorValue $r[0] ($r[1] + 5) $r[2] particleShape1;

and note the position of the "-query" flag at the end before the object name
 
Old 03 March 2013   #5
Hey Toby, I just tested my code and it works here.

vector $rot = particle2_grassShape.rotationPP;
particle2_grassShape.rotationPP = <<$rot.x,$rot.y,rand(0,360)>>;

This expression wil randomly change only the z rotation each sub-step. I'm guessing that is probably not what you want. Are you trying to roll the particles at random speeds maybe? I'm happy to help further, but figure I'd ask what you are trying to achieve first.

@zaskar: This is an expression, not a mel script. You can do things in expressions more directly than in mel. The syntax is slightly different.

David
__________________
http://www.djx.com.au
 
Old 03 March 2013   #6
djx, thank you, it works now!!! :-)
__________________
www.mackevision.com
 
Old 03 March 2013   #7
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
CGSociety
Society of Digital Artists
www.cgsociety.org

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

All times are GMT. The time now is 11:15 AM.


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