PDA

View Full Version : Orbiting

acemasters
04-22-2013, 10:30 PM
I'm working on a world where two spaceships must orbit the Earth. One must be close to the
Earth and orbiting fast. The other must be far away and orbit slowly. The first one I have
done. But when I work on spaceship number two adding it to the call all it does is rotate
in place without moving. And if I add While to the call it ends up stopping the first
spaceship from orbiting. Can someone help me find what I am missing?

x2495iiii
04-23-2013, 12:38 AM
The problem is that spaceship 2 is huge compared to spaceship 1.

Try scaling it down to about the same size as spaceship 1.

acemasters
04-23-2013, 10:16 AM
I will try that and get back to you on the results.

acemasters
04-23-2013, 04:29 PM
The problem is that spaceship 2 is huge compared to spaceship 1.

Try scaling it down to about the same size as spaceship 1.

That didnt help one bit. But I found something in the later chapters that explained making the ship turn 1 resolution as seen by the globe abruptly and it seems to work. I mention this incase someone else has the same problem I did.

x2495iiii
04-23-2013, 06:58 PM
I'm guessing you did it wrong. Spaceship 2 was so far away that when scaled properly, it was practically invisible. After making another, normal sized one, placing it properly,

http://i842.photobucket.com/albums/zz348/DummyX/pic1_zps3cf1bbcb.jpg

deleting the unnecessary ground, and finally, deleting most of the code you had in place and replacing it with two independent but simultaneous infinity loops with altered durations, you can see what I mean.

http://i842.photobucket.com/albums/zz348/DummyX/pic2_zpsd53ad9bc.jpg

Glad you figured it out, though.

chickentree
04-27-2013, 11:50 AM
I'm working on a world where two spaceships must orbit the Earth. One must be close to the
Earth and orbiting fast. The other must be far away and orbit slowly. The first one I have
done. But when I work on spaceship number two adding it to the call all it does is rotate
in place without moving. And if I add While to the call it ends up stopping the first
spaceship from orbiting. Can someone help me find what I am missing?

There are a couple of problems with your approach. First let me state that there are usually several ways to do something in a program and it is not what is right or wrong its what best reflects the problem or meets the constraints of the system involved.
In Alice you are working with graphical objects and there are some options that should be used whenever possible. If you want one thing to move around another, smoothly and without a "box step" look use the "as seen by" option to the turn command. As in:
spaceship turn right 1 revolution as seen by globe
or better yet, for your situation:
spaceship turn at speed 0.1 revolutions per second as seen by globe

Also (IMHO) using infinite loops in your methods is not a good idea. It causes problems that are hard for a beginner to ferret out and seems to bog Alice down when compared to using events. If you truely want to have the ships orbit all the time, add a "When the world starts" event and the right click it and change it to while the world is running and through your circle method in the "during" section.
Another choice would be to use the "When something is true" event. You can then create a boolean variable that can turn the orbiting on and off whenever you want.

Mark

Brettlee
06-06-2013, 07:10 AM
Well, I am also looking to have an answer about how orbiting could be done. If anyone has answer of it reply...