Posted: 2nd Jan 2004 23:16
I made this earlier, it WAS going to be newtons cradle, but then my brain started hurting with the realisation that the physics involved are much more complicated that you first think.

Thought i would issue a challenge, no prizes for the person who can do the most (of anything) in the shortest time, starting with this snippet - whether thats amazing graphical effects, or more realistic motion, i leave it up to those who are bored enough to try Post screenies here!

+ Code Snippet
`Phsyics Tech Demo

set display mode 800,600,32
sync on

`knock up 5 objects in the shed -- balls to you!
for i=1 to 5
   `any size up to 100 - lower numbers let you see the kinetic energy transfer.
   make object sphere i,50
   position object i,0,0,i*100
   set object smoothing i,100
next i

move object 1,-1000

Type Ball
   velocity AS FLOAT
   mass as float
   pz as float
Endtype

dim Balls(5) as Ball

balls(1).velocity=10
object=1

`make a floor
make object plain 10,2000,2000
position object 10,0,-100,500
pitch object up 10,90
set reflection shading on 10

make object box 11,2000,2000,10
position object 11,0,-110,500
pitch object up 11,90
color object 11,rgb(200,200,255)

set object diffuse 11,rgb(0,0,0)

`Set up the worlds mood lighting
color backdrop rgb(10,0,0)

`Show off some FX :)
`hide light 0
set ambient light 30

set object specular 1,rgb(200,0,0)
`set object specular power 1,1

set object emissive 1,rgb(20,20,0)
set object emissive 2,rgb(20,0,0)
set object emissive 3,rgb(0,20,0)
set object emissive 4,rgb(0,0,20)
set object emissive 5,rgb(0,20,20)

set object ambient 5,1
set object ambience 5,rgb(0,0,0)


`Have a look... can you guess what it is yet?
position camera 700,300,200
point camera object position x(3), object position y(3), object position z(3)

`Terminal loop

while escapekey()=0

camy=camera position y()
camz=camera position z()
camx=camera position x()

if upkey()=1 then inc camy,3
if downkey()=1 then dec camy,3

if leftkey()=1 then dec camx,3
if rightkey()=1 then inc camx,3

if inkey$()="<" or inkey$()="," then dec camz,3
if inkey$()=">" or inkey$()="." then inc camz,3

position camera camx,camy,camz

    `slight slowing of the object to loosely simulate air resistance
    if object=1 then balls(object).velocity=balls(object).velocity+.02
    if object=5 then balls(object).velocity=balls(object).velocity-.02

    z=balls(object).pz
    inc balls(object).pz,balls(object).velocity/10
    newz=balls(object).pz

    position object object,object position x(object),object position y(object),balls(object).pz
    point camera object position x(3),object position y(3), object position z(3)

    if newz-z>0 and object<5
      if object collision(object,object+1)
         balls(object+1).velocity=balls(object).velocity
         balls(object).velocity=0
         inc object,1
         balls(object).pz=object position z(object)
      endif
    endif

    if newz-z<0 and object>1
      if object collision(object,object-1)
         balls(object-1).velocity=balls(object).velocity
         balls(object).velocity=0
         dec object,1
         balls(object).pz=object position z(object)
      endif
    endif

    pitch object up object,1

   `we worked so hard on it, so draw it.  refresh screen every (nn) loops to increase speed
   inc framerate,1
   if framerate>=6 then sync : framerate=0
endwhile

Posted: 10th Jan 2004 3:29
awesome!