Hi Dan,
Maybe you are looking for Takashi-san’s ODECo?
http://languagegame.org:8080/ggame/15
Alan Kay uses a bouncing ball all the time in his talks. He does a nice example of a bouncing ball that deforms. And he does it while its bouncing. Very cool video. https://plus.google.com/113828454523913869336/posts/GU89wzvFTY6
Here is a really cool paper that shows you all the tools you need are really right there in Morphic. http://www.vpri.org/pdf/rn2005001_learning.pdf
If you know the laws of physics you can model them.
All the best,
Ron Teitelbaum
From: beginners-bounces@lists.squeakfoundation.org [mailto:beginners-bounces@lists.squeakfoundation.org] On Behalf Of summae3443@mypacks.net Sent: Wednesday, November 19, 2014 10:15 PM To: beginners Subject: [Newbies] Bounce Example
Hello,
I once saw a workspace example which caused a morph to move along an arc in a realistic way - appearing to be affected by gravity. Possibly written by someone from Disney? Now I search in vain to find it. Please give me a reference.
- Dan
Ron Teitelbaum wrote:
If you know the laws of physics you can model them.
Right! Squeak is a great place to model or even break the laws of physics.
Here is a great set of Squeak Etoys for NASA from physics professor Randy Caton
http://www.pcs.cnu.edu/~rcaton/SqIndex/squeakindex.html
Etoys isn't the Smalltalk workspace, but the simple tile scripting language built into Squeak.
Here are more Etoys on physics, but you don't need to be a Squeak Central or NASA guru to make them, as I show in Free Fall.
Particle Gas Model (Yoshiki Ohshima) http://squeakland.org/showcase/project.jsp?id=7430 Ball Drop Analysis 1 (Alan Kay) http://squeakland.org/showcase/project.jsp?id=7425 Collision Physics (Bert Freudenberg) http://squeakland.org/showcase/project.jsp?id=7052 Lunar Lander Game (Alan Kay) http://squeakland.org/showcase/project.jsp?id=7424 Free Fall (David Corking) http://www.squeakland.org/showcase/project.jsp?id=9709
Have fun! David
On 20.11.2014, at 04:14, summae3443@mypacks.net summae3443@mypacks.net wrote:
Hello,
I once saw a workspace example which caused a morph to move along an arc in a realistic way - appearing to be affected by gravity. Possibly written by someone from Disney? Now I search in vain to find it. Please give me a reference.
Morphic is not really set up for workspace-style programming. It assumes you will create your own morph class and implement methods to specify behavior.
It's certainly possible to do. But you will run into various problems that you wouldn't have if you did it properly.
That said, try the following. Assuming constant mass and gravity, the acceleration is constant (since F = ma).
m := Morph new openInWorld. m position: World center. speed := 5 @ 0. "move horizontally at start" acceleration := 0 @ 1. "accelerate downwards" move := [m owner ifNotNil: [ "Acceleration is a 2nd-order (quadratic) function. Physics and Math FTW" speed := speed + acceleration. "accel is 1st derivative of speed" m position: m position + speed. "speed is 1st derivative of pos" m left < m owner left ifTrue: [speed := speed x abs @ speed y]. "bounce" m right > m owner right ifTrue: [speed := speed x abs negated @ speed y]. m top < m owner top ifTrue: [speed := speed x @ speed y abs]. m bottom > m owner bottom ifTrue: [speed := speed x @ speed y abs negated]. (move future: 20) value. "repeat every 20ms" ]]. move value. "first step"
For even more fun you could control the morph with a joystick:
j := JoystickMorph new openInWorld.
And insert this inside the move block:
acceleration := (j leftRight @ j upDown negated) * 0.1.
Have fun!
- Bert -
beginners@lists.squeakfoundation.org