MEL scripts

Become a member of the CGSociety

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

REPLY TO THREAD
 
Thread Tools Display Modes
  11 November 2016
rand rotation change every frame.

hi all.

look for simple expression. i want to choose my rotation when the particle hit the floor with a little bit of random.

like : rotationPP = rand (95,120); but with this the particle keep changing every frame between 95,120.
i tried to : rotationPP = 95 && 120; but doesnt work.

hope its clear .

cheers.
 
  11 November 2016
Ok, so what you want to do is have a switch which activates every time the particle collides. To do this - add a new attribute to the particle called "hit" Make it a float, perparticle attribute. got it?

Now, you want to add a little checker to your runtime before dynamics that compares the "eventCount[0]" attribute to the "hit" attribute. "EventCount[0]" automatically increases every time a particle collides - so by default the particle knows its own collision counter.

$count = eventCount[0];
if ($count != $hit){$rotation = $newValue; $hit = $count;}

One more thing to add is that you may want to add a condition that skips this process if the particle is resting on the ground. To do that you can add somehting like this;

$velocity = velocity;
$tolerance = 0.1;

if ($velocity > $tolerace){
$count = eventCount[0];
if ($count != $hit){$rotation = $newValue; $hit = $count;}
}
 
  02 February 2017
Toggle Convert Selectinon To...

Hey. I had the idea to combine 3 standard commands in one toggle.

ConvertSelectionToContainedFaces
ConvertSelectionToVertexPerimeter
ConvertSelectionToEdgePerimeter

Originally selected face. When you press one key is too much between the outer vertices, edges, and a return to the inner face or the face group.

I think it's quite simple to implement with the help of programming and it will be a useful tool. I am hope for your help. Thank you!
 
  03 March 2017
resize image in layout

How do mimic the image resizing behavior of Maya's image preview pane in the file browser?

i.e. how do I tell maya to dynamically resize an image to fit within its parent? Right now I'm using formLayout, should I be using something else?
 
  09 September 2017
Hi Guys,

I am a newbie and having trouble running this script.Can you guys please help me with this script, When I run the exe file, it is giving me an error

https://www.highend3d.com/maya/scri...-batch-for-maya
 
  2 Weeks Ago
Hello, I'm pretty new to MEL and I ran into a problem I can't figure out.
I basically have an array, lets say its $array [] ={1, 2, 3, 4, 5, 6}; I want a way for it to add all of the previous iterations to each element in the array so in this example I would end up with 1,3,6,10,15,21. 1 is 1. 2+1 is 3. 3+2+1 is 6 and so forth. Ideally I'm trying to find a way for it to work no matter how many numbers are in the array.
I'm basically stuck trying to make this in a way that isn't overly complicated.

Right now I have a start but it seems like a complicated way that only allows me to use a determined number of array elements. I feel like I'm going about this the wrong way. If anyone could help me out it would be much appreciated! Thanks!

What I have so far:

int $array[]= {1, 2, 3, 4, 5, 6};
int $g;
for ($g = 0; $g < size($ar); $g++) {
if ($g - 1 > -1) {
print ($array[$g] + $array[$g -1] + "\n") ;
}
else {
print ($array[$g]+ "\n");
}
}
 
reply 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 12:44 PM.


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