View Single Post
# 1 04-10-2003 , 09:17 PM
nspiratn's Avatar
Registered User
Join Date: Dec 2002
Location: CA
Posts: 211

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