Simply Maya User Community

Simply Maya User Community (https://simplymaya.com/forum/index.php)
-   Programming (https://simplymaya.com/forum/forumdisplay.php?f=32)
-   -   Mel help (https://simplymaya.com/forum/showthread.php?t=15676)

Neo-MatrixX 02-03-2005 08:45 PM

Mel help
 
Hello,

I'm trying to create a number of cones randomly on the ground
using mel.
so far i have the following, but cant figure out how to get the
cones on the ground.

vector $rand;
for ($i = 0;$i<20;$i++)
{
$rand = sphrand(10);
cone -p ($rand.x) ($rand.y) ($rand.z);
}


If anyone could, it would be greatly appreciated

kbrown 02-03-2005 08:59 PM

What exactly is your ground?

Neo-MatrixX 02-03-2005 09:02 PM

It can be any flat surface like a polygon plane.

LauriePriest 02-03-2005 09:11 PM

you have a random value on the y axis, would that make it so that they would go anywhere rather than stay on one plane?

Neo-MatrixX 02-03-2005 09:26 PM

Yeah feel free to change the coding in anyway,
as long as the cones are placed randomly on a flat surface

thanx

Alan 11-03-2005 02:53 PM

float $xpos;
float $ypos;
float $zpos;

for ($i = 0;$i<20;$i++)
{
$xpos = rand(-10, 10);
$ypos = 0;
$zpos = rand(-10, 10);

cone -p $xpos $ypos $zpos;
}


that's what i'd do. You could make it "clever" by making take the size of the surface into account but I don't have time to write that atm.

:ninja:
Alan


All times are GMT. The time now is 07:06 AM.

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Simply Maya 2018