## Maya Training

Creating characters In Maya and Zbrush

## Maya Training

Creating character renders in Maya 2017 and Arnold

## Maya Training

Spach-Alspaugh House the complete courseware
You are here > Home > SimplyMaya Community Forums

# Welcome to Simply Maya

 Simply Maya User Community - Maya Tutorials make the moon revolve around the earth
 Register FAQ Members List Calendar Mark Forums Read

 04-10-2003, 10:17 PM #1 nspiratn Registered User     Join Date: Dec 2002 Location: CA Posts: 211 Thanks: 0 Thanked 0 Times in 0 Posts make the moon revolve around the earth Hi, I'm trying to write a basic script to make 1)the earth revolve around the sun 2)the moon revolve around the earth At this point, I have both the earth and the moon revolving around the sun. This is the script - --------------------- sphere; select -r nurbsSphere1 ; addAttr -ln distance -at double -min 1 -max 10 -dv 8 |nurbsSphere1; setAttr -e -keyable true |nurbsSphere1.distance; expression -n "xexp" -s "nurbsSphere1.tx = nurbsSphere1.distance * sin(time)"; expression -n "yexp" -s "nurbsSphere1.ty = nurbsSphere1.distance * cos(time)"; sphere -r 0.25 ; select -r nurbsSphere2 ; addAttr -ln distance -at double -min 1 -max 10 -dv 10 |nurbsSphere2; setAttr -e -keyable true |nurbsSphere2.distance; expression -n "xexp" -s "nurbsSphere2.tx = nurbsSphere2.distance * sin(time)"; expression -n "yexp" -s "nurbsSphere2.ty = nurbsSphere2.distance * cos(time)"; sphere -r 3; playbackOptions -min 1 -max 300 ; ---------------------------------- The problem I have is : The moon's x and y co-ordinates have to change to keep up with the earth's orbit around the sun. BUT, the moon's x, y co-ordinates ALSO have to change locally with respect the earth itself so it can remain in orbit around the earth. So, how do I animate the moon so that it can do both?? I hope you're getting my drift here. btw, I have a gut feeling that there is a very simple solution to this but I am just blanking out. thanks. Attached Thumbnails   __________________ ~nspiratn
 04-10-2003, 10:47 PM #2 kbrown Moderator     Join Date: Sep 2002 Location: London, UK Posts: 3,198 Thanks: 0 Thanked 8 Times in 8 Posts You need to think of this how would you do it manually. Perhaps by setting the earth's pivot in the middle of the sun and the moon's pivot in the middle of the earth. Then parent the moon to the earth and create the necessary expressions to rotate everything. __________________ Kari - My Website - My IMDB Do a lot, Fail a lot and Learn a lot!
04-10-2003, 10:58 PM   #3
kbrown
Moderator

Join Date: Sep 2002
Location: London, UK
Posts: 3,198
Thanks: 0
Thanked 8 Times in 8 Posts

here's a quick (maya 4.5) scene file for you to investigate:
Attached Files
 earrh_moon_sun.zip (6.4 KB, 43 views)
__________________
Kari
- My Website
- My IMDB

Do a lot, Fail a lot and Learn a lot!

 04-10-2003, 10:58 PM #4 mtmckinley The Maya Mountain     Join Date: Aug 2002 Location: Seattle, WA Posts: 8,245 Thanks: 1 Thanked 25 Times in 25 Posts I agree. __________________ -Mike www.mtmckinley.net The Maya Toolbelt
 14-10-2003, 12:53 AM #5 mark_wilkins Registered User     Join Date: Jan 2003 Posts: 161 Thanks: 0 Thanked 1 Time in 1 Post Why not just parent the objects to each other and rotate the transform? Making additional transforms by grouping can allow you to decouple an object's rotation from its orbital motion (although in real life, rotation to orbit duration ratios of 1:1, 2:1, and 3:1 are common, and 1:1 is what you get with straight parenting... the others can be done with a simple expression.) -- Mark __________________ Mark R. Wilkins author of MEL Scripting for Maya Animators www.melscripting.com

A little bit about who we are