Alice Community  

Go Back   Alice Community > Alice 2 > How do I...?

Reply
 
Thread Tools Display Modes
Orbiting
Old
acemasters
Guest
 
Status:
Posts: n/a
Default Orbiting - 04-22-2013, 11: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?
Attached Files
File Type: a2w Chap 6 ex 7.a2w (1.73 MB, 10 views)
   
Reply With Quote
Old
x2495iiii
Super Moderator
 
x2495iiii's Avatar
 
Status: Offline
Posts: 3,508
Join Date: Dec 2008
Location: Somewhere in the Continental U.S.
Default 04-23-2013, 01: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.


(')>
   
Reply With Quote
Old
acemasters
Guest
 
Status:
Posts: n/a
Default 04-23-2013, 11:16 AM

I will try that and get back to you on the results.
   
Reply With Quote
Old
acemasters
Guest
 
Status:
Posts: n/a
Default 04-23-2013, 05:29 PM

Quote:
Originally Posted by x2495iiii View Post
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.
   
Reply With Quote
Old
x2495iiii
Super Moderator
 
x2495iiii's Avatar
 
Status: Offline
Posts: 3,508
Join Date: Dec 2008
Location: Somewhere in the Continental U.S.
Default 04-23-2013, 07: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,



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.



Glad you figured it out, though.


(')>
   
Reply With Quote
Old
chickentree
Super Moderator
 
Status: Offline
Posts: 212
Join Date: Dec 2012
Location: Frosno, Ca
Default 04-27-2013, 12:50 PM

Quote:
Originally Posted by acemasters View Post
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
   
Reply With Quote
Old
Brettlee
Junior Member
 
Status: Offline
Posts: 14
Join Date: May 2013
Location: New York
Default 06-06-2013, 08:10 AM

Well, I am also looking to have an answer about how orbiting could be done. If anyone has answer of it reply...
   
Reply With Quote
Reply

Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump



Copyright ©2017, Carnegie Mellon University
Alice 2.x 1999-2012, Alice 3.x 2008-2012, Carnegie Mellon University. All rights reserved.