Thanks for the answers .. i did it using some mathematical formulas... took some time to figure them out.
On Apr 17, 11:09 am, Lami <[email protected]> wrote: > Hey anndorian > > I'm doing quite the same as you for an university project at the > moment and was doing it like Peter explained! > Furthermore you don't even have to calculate the rotation by yourself, > you can just use rotationY. > > this is how I'm doing that: > > //Create the sun > sun = new Sphere( { radius:10 } ); > //Create the earth > earth = new Sphere( { radius:5 } ); > //Create container for earth (needed for circular rotation) > earthContainer = new ObjectContainer3D(); > //Add earth to its container and offset from container > position > earthContainer.addChild(earth); > earth.z = -100; > //Same for the moon > moon = new Sphere( { radius:2 } ); > //Set the moon Container to the earth coordinates > moonContainer = new ObjectContainer3D( { x:earth.x, y:earth.y, > z:earth.z } ); > moonContainer.addChild(moon); > moon.z = -20; > earthContainer.addChild(moonContainer); > view.scene.addChild(sun); > view.scene.addChild(earthContainer); > > //Rotates the earth around its own axis > earth.rotationY += 2; > //Rotates the earth around the sun > earthContainer.rotationY += 1; > //Rotates the moon around the earth > moonContainer.rotationY +=4; > > Of course the scene is not physically correct, but that should be the > basic functionality! > Hope this helps and let me know if it works for you! > > cheers > Lami > > On 17 Apr., 02:15, anndorian <[email protected]> wrote: > > > Ok, I have a star and a planet orbiting around it using : > > > // posX - distance between star and planet > > theta=Math.PI; > > > theta -= (speed * 0.1) / 180 * Math.PI; > > > body.x = Math.cos(theta) * posX; > > body.z = Math.sin(theta) * posX; > > > The problem is I don't know how to put a satellite orbiting that > > planet ( which orbits the star ). Can anyone help me ? > > > Thanks.
