Maya Training

Introduction to Hard Surface Modeling

Maya Training

Interiors and Furniture Vol 1 & 2 - Modeling & Cloth

Maya Training

Shading, Lighting and Rendering the Bedroom in MR

Maya Training

Robot volume one - Modeling with animation in mind

Maya Training

Spach-Alspaugh House the complete courseware

Maya Training

Burt The Cartoon Dinosaur Vol 01 - Modeling

New Maya Training

Robot Volume 02 - Hybrid Rigging
You are here > Home > SimplyMaya Community Forums
Loading

Welcome to Simply Maya

Please Sign in or Sign up for an account

Member Login

Lost your password?

Not a member yet? Sign Up!

Old 07-09-2009, 08:06 AM   #1
Falott
Registered User
 
Falott's Avatar
 
Join Date: Jan 2005
Location: vienna
Posts: 1,095
Thanks: 3
Thanked 20 Times in 18 Posts
Default fit objects to surface

ok, this question must have been risen here allready I just cant find anything - so here´s my question.


I have a wide area of soil with grass on it. the plants which are needed to be placed on the ground are lowPoly-alphaTexture models simply planes most of the time. the ground surface is uneven. so -

the tricky part - I´ve allready placed the plants from the top view. what I now need is to make them stick/fit to the surface by somehow constraining them with a script (only Y-axis matters in this case.) paying attention to the Y-axis and only and the normalDirection of the soily groundSurface.

I got about 10,000 (simple planes only) objects, so I realy need a script or something.

I allready googled alot, but theres nothing I found what is actually working how it´s supposed to do. maybe I just used wrong keywords...

reminder: I dont want to fit the objects to vertices - they just need to be moved down until touching the surfaceGeometry.

I hope anyone can help me. Script, Url, ideas - it doesn´t matter - any input is greatly appreciated!
__________________
everything starts and ends in the right place at the right time.
Falott is offline   Reply With Quote
Old 08-09-2009, 06:55 PM   #2
daverave
The thin red line
 
daverave's Avatar
 
Join Date: Aug 2009
Location: England
Posts: 4,471
Thanks: 101
Thanked 952 Times in 879 Posts
Default

Couldnt find any thing Mel script but found this tutorial.
hope this helps

http://learnfobia.com/category-Maya-...Maya-2257.html
daverave is offline   Reply With Quote
Old 10-09-2009, 06:52 PM   #3
daverave
The thin red line
 
daverave's Avatar
 
Join Date: Aug 2009
Location: England
Posts: 4,471
Thanks: 101
Thanked 952 Times in 879 Posts
Default

I am new to mel script just finding my feet but I think what you are looking for is geometryConstraint I have tried to wright script but only works for the first one selected

string $mySelection[] = `ls -sl`;
delete `geometryConstraint -weight 1 $mySelection[0] $mySelection[1]`;

This is suppost to work that the first one selected is the ground then select all others that you want to move to it then it deletes the constraint

hope you can make some thing of this.......dave
daverave is offline   Reply With Quote
Old 11-09-2009, 09:30 AM   #4
Falott
Registered User
 
Falott's Avatar
 
Join Date: Jan 2005
Location: vienna
Posts: 1,095
Thanks: 3
Thanked 20 Times in 18 Posts
Default

some lines of code thrown together

string $stem = "dupe_";
string $suffix= "_GEO";
string $dupeSel[] = `ls ($stem + "*" + $suffix)`;



// this is from an older script of mine. the default objects
// to randomly duplicate them are named like
// dupe_1_GEO, dupe_2_GEO, ... / I painted particles to a
// live surface and instanced geometry to them



int $count = `particle -q -count particleShape1`;
for ($i =0 ; $i < $count; $i++)
{
$pPos = `getParticleAttr -at position particleShape1.pt[$i]`;
$object = `duplicate $dupeSel`;
move $pPos[0] $pPos[1] $pPos[2] $object;
}
__________________
everything starts and ends in the right place at the right time.
Falott is offline   Reply With Quote
Old 12-09-2009, 04:17 PM   #5
NextDesign
Technical Director
 
NextDesign's Avatar
 
Join Date: Feb 2004
Posts: 2,982
Thanks: 33
Thanked 532 Times in 471 Posts
Default

Set the pivot points to the bottom of the cards. Select the ground and the cards (or other way around, can't remember) and use Animation>Constraints>Geometry Constraint.

You'll need to do this for every card, so run this script instead. You'll need to run the constraint first on one card to get your settings. Select all your cards first.

$sel = `ls -sl`;

for ($obj in $sel)
{
// geometry constraint settings go here
}

Hopefully you can get it to work. If not, I'll post up the full code tonight.
__________________
Imagination is more important than knowledge.

Last edited by NextDesign : 12-09-2009 at 04:24 PM.
NextDesign is offline   Reply With Quote
Old 16-09-2009, 12:48 PM   #6
Falott
Registered User
 
Falott's Avatar
 
Join Date: Jan 2005
Location: vienna
Posts: 1,095
Thanks: 3
Thanked 20 Times in 18 Posts
Default

woohooo!

perfect! thx alot!
__________________
everything starts and ends in the right place at the right time.
Falott is offline   Reply With Quote
Old 20-09-2009, 05:03 AM   #7
NextDesign
Technical Director
 
NextDesign's Avatar
 
Join Date: Feb 2004
Posts: 2,982
Thanks: 33
Thanked 532 Times in 471 Posts
Default

No problem mate. Glad to help!
__________________
Imagination is more important than knowledge.
NextDesign is offline   Reply With Quote
Reply


Similar Threads
Thread Thread Starter Forum Replies Last Post
Problem solving many dynamic objects in a pile? rohiniduggal Dynamics & Special Effects 3 14-01-2011 07:26 PM
Strange Problem - Unable to change attributes for multiple objects anthonysw3 Technical Issues 4 04-12-2010 11:56 PM

Thread Tools





A little bit about who we are
Links you might find useful
Catch up with SimplyMaya
SimplyMaya specialises in Maya tutorials. We offer over 1,000 individual Maya training videos, ranging from basic Maya tutorials through to intermediate Maya tutorials. Our tutorials are created by instructors with industry experience and are designed to get you up and running in Maya quickly without making it seem like hard work.

Copyright © 1999-2015 SimplyMaya - vBulletin® Copyright © 2000-2015, Jelsoft Enterprises Ltd.