Alice Community Gravity and ballistic motion

 Gravity and ballistic motion
groucho
Guest

Status:
Posts: n/a
Gravity and ballistic motion - 04-21-2008, 02:09 AM

As a phyisicist, I wanted to add motion taking earth's gravity into account to Alice. Motion should be physically realistic, reasonably smooth and should incorporate free fall, general ballistic trajectories and bouncing of objects.

After much more work than originally anticipated, I came up the enclosed solution. The world "GravityDemo" shows a couple of examples of how to the methods may be used.

The relevant methods are all incorporated in a separate library object (GLib) which can be saved and imported in other worlds. The two basic methods are "freeFallGeneral" and "riseGeneral" for objects initially falling or rising up. For special cases, I've added are a couple of convenience methods. Also, there are several function (timeToPeak, timeForFall, maxHeight, maxRange) to help setting up scenes or joining motions.

The parameters of the methods are reasonably well documented in the comments. Enjoy!
Attached Files
 GravityDemo.a2w (1.26 MB, 893 views)

 Well done!
 DickBaldwin Guest   Status: Posts: n/a Well done! - 04-21-2008, 06:32 AM Well done. Your motions are very smooth on my desktop machine and your examples should peak the interest of many students. Dick Baldwin Free Alice tutorials: http://www.dickbaldwin.com/tocalice.htm Free programming tutorials: http://www.dickbaldwin.com/toc.htm
 Very well done!
 lanceA Guest   Status: Posts: n/a Very well done! - 04-21-2008, 09:04 AM Excellent piece of programing with Alice. Congratulations on the finished product!
 "Gravity Library"
 DrJim Guest   Status: Posts: n/a "Gravity Library" - 04-21-2008, 08:09 PM Very nice. I could see these being useful on a stand alone basis as a teaching aid for physics classes. It makes you wish even more for polymorphism, true class libraries and all the good stuff "coming in release 3.0." Also are you planning on making a bounce function for a reference plane other than the ground? For people currently wanting to use the libraries and Alice 2.0, it would be worth reviewing the thread http://www.alice.org/community/showt...ight=clipboard which describes how to copy something from one world to another. If you first export the library objects as .a2c files and then import them to the new world, there seem to be minimal problems with the clipboard drag and drop (a very nice feat of programming in itself). Since all of an objects methods come with it - this step also eliminates a lot of the need for copying via the clipboard.
groucho
Guest

Status:
Posts: n/a
04-22-2008, 02:31 AM

Thank you for the kind words. I am fascinated by the visual power of Alice and think it deserves even more attention.

Quote:
 Originally Posted by DrJim Also are you planning on making a bounce function for a reference plane other than the ground?
Well, in a limited way, that's already incorporated. Objects do not automatically bounce off ground, but they bounce after having fallen for a height "fallingHeight". To make the object bounce off ground, you need to set "fallingHeight" to the height of the object above ground.

However, if the object starts above another object, simply set "fallingHeight" to the height of the falling object above the second object and it will bounce from there.

The limitation is that objects can only bounce from planes parallel to ground and that the plane must be known beforehand (i.e., there is no true collision detection).

 Write it out
 dakota95 Senior Member     Status: Offline Posts: 426 Join Date: Aug 2011 Location: like I would tell you. ;) Write it out - 08-11-2011, 01:35 PM Can you write what to do out? My computer won't let me view the post.
dubastot
Senior Member

Status: Offline
Posts: 661
Join Date: Apr 2009
Location: Two Steps From Hell
10-19-2011, 10:53 PM

Quote:
 Originally Posted by dakota95 Can you write what to do out? My computer won't let me view the post.
Dude, this is from 2008... We are in 2011.

I'm a web developer/ designer now.

 Thread Tools Display Modes Linear Mode

 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 Rules
 Forum Jump User Control Panel Private Messages Subscriptions Who's Online Search Forums Forums Home Announcements     Community News and Announcements Alice 3     How Do I?     Works In Progress     Share Your World     Share Custom Classes     Bugs and Trouble Shooting     Suggestion Box Alice 2     How do I...?     Works-In-Progress     Share Worlds     Share Objects     Bugs and Troubleshooting     Suggestion Box Educators     Teaching with Alice     Teaching Using Alice 3     Teaching Using Alice 2     CS Principles and Alice     AP CSA and Intro to Java and Alice     Workshops General Discussion     Questions and Comments     The Lounge