Introduction to Maya - Modeling Fundamentals Vol 2
This course will look in the fundamentals of modeling in Maya with an emphasis on creating good topology. It's aimed at people that have some modeling experience in Maya but are having trouble with complex objects.
# 1 02-03-2005 , 08:45 PM
Neo-MatrixX's Avatar
Registered User
Join Date: Feb 2004
Posts: 26

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

# 2 02-03-2005 , 08:59 PM
kbrown's Avatar
Moderator
Join Date: Sep 2002
Location: London, UK
Posts: 3,198
What exactly is your ground?


Kari
- My Website
- My IMDB

Do a lot, Fail a lot and Learn a lot!
# 3 02-03-2005 , 09:02 PM
Neo-MatrixX's Avatar
Registered User
Join Date: Feb 2004
Posts: 26
It can be any flat surface like a polygon plane.

# 4 02-03-2005 , 09:11 PM
LauriePriest's Avatar
Moderator
Join Date: May 2003
Location: London
Posts: 1,001
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?

# 5 02-03-2005 , 09:26 PM
Neo-MatrixX's Avatar
Registered User
Join Date: Feb 2004
Posts: 26
Yeah feel free to change the coding in anyway,
as long as the cones are placed randomly on a flat surface

thanx

# 6 11-03-2005 , 02:53 PM
Alan's Avatar
Moderator
Join Date: Oct 2002
Location: London, UK
Posts: 2,800
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.

user added image
Alan


Technical Director - Framestore

Currently working on: Your Highness

IMDB
Posting Rules Forum Rules
You may not post new threads | You may not post replies | You may not post attachments | You may not edit your posts | BB code is On | Smilies are On | [IMG] code is On | HTML code is Off

Similar Threads