beark able chair.
Rem Project: phybreakthechair1
Rem Created: 11/08/2006 17:54:44
Rem ***** Main Source File *****
sync on
sync rate 60
phy start
autocam off
position camera -20,20,-25
point camera 0,10,0
make light 1
set directional light 1, -5,-5,5
` make a background sphere
load image "stripe5.png",1000
make object sphere 1000,400,48,48
texture object 1000,1000
scale object texture 1000,6,6
set object cull 1000,0
rotate object 1000,0,0,90
`make a physics material for the objects
phy make material 1, "wooden"
phy set material static friction 1, 25.0
phy set material restitution 1, 0.0
phy set material dynamic friction 1, 1.0
phy build material 1
` make our ground
load image "stripe6.png", 3
make object box 1,40,1,40
phy make rigid body static box 1
texture object 1, 3
`prepare the variables for creating chairs
global lw# = 1.0
global lt# = 10.0
global cw# = 5.0
global sw# = 11.0
global cxp# = -10.0
global cyp# = 10.0
global ch# = 35.0
`drop the ball
make object sphere 6,3
position object 6,0,120,0
phy make rigid body dynamic sphere 6
` change this to make heavier
phy set rigid body mass 6,1000
`make a chair
create_chair(0,0,0.0,10)
do
phy update
sync
loop
function create_chair(cxp#,cyp#,ch#,first_obj)
` this function is responsible for creating a chair object
col_r = rnd(254)
col_g = rnd(254)
col_b = rnd(254)
make object box first_obj,sw#,lw#,sw#
position object first_obj,cxp#,(ch#+lt#)+0.5,cyp#
color object first_obj,rgb(col_r,col_g,col_b)
make object box first_obj+1,lw#,lt#,lw#
position object first_obj+1,cxp#-cw#,ch#+(lt#/2.0),cyp#+cw#
color object first_obj+1,rgb(10,10,64)
make object box first_obj+2,lw#,lt#,lw#
position object first_obj+2,cxp#+cw#,ch#+(lt#/2.0),cyp#+cw#
color object first_obj+2,rgb(10,10,64)
make object box first_obj+3,lw#,lt#,lw#
position object first_obj+3,cxp#-cw#,ch#+(lt#/2.0),cyp#-cw#
color object first_obj+3,rgb(10,10,64)
make object box first_obj+4,lw#,lt#,lw#
position object first_obj+4,cxp#+cw#,ch#+(lt#/2.0),cyp#-cw#
color object first_obj+4,rgb(10,10,64)
make object box first_obj+5,lw#,lt#,lw#
position object first_obj+5,cxp#+cw#,(ch#+lt#)+((lt#/2.0)+1.0),cyp#+cw#
color object first_obj+5,rgb(10,10,64)
make object box first_obj+6,lw#,lt#,lw#
position object first_obj+6,cxp#-cw#,(ch#+lt#)+((lt#/2.0)+1.0),cyp#+cw#
color object first_obj+6,rgb(10,10,64)
make object box first_obj+7,sw#-2.0,lw#*4.0,lw#
position object first_obj+7,cxp#,(ch#+lt#)+((lt#/2.0)+3.0),cyp#+cw#
color object first_obj+7,rgb(col_r,col_g,col_b)
for j = first_obj to first_obj+7
set object specular j,rgb(255,255,255)
set object specular power j,100
if j > first_obj and j < (first_obj+7) : set sphere mapping on j,2 : fade object j,150 : endif
set object smoothing j,68.0
phy make rigid body dynamic box j,1
next j
phy make fixed joint first_obj,first_obj,first_obj+1
phy make fixed joint first_obj+2,first_obj,first_obj+2
phy make fixed joint first_obj+3,first_obj,first_obj+3
phy make fixed joint first_obj+4,first_obj,first_obj+4
phy make fixed joint first_obj+5,first_obj,first_obj+5
phy make fixed joint first_obj+6,first_obj,first_obj+6
phy make fixed joint first_obj+7,first_obj+5,first_obj+7
phy make fixed joint first_obj+8,first_obj+6,first_obj+7
phy make fixed joint first_obj+9,first_obj,first_obj+7
for jj=first_obj to first_obj+9
phy set joint break limits jj, 7000, 7000
next jj
endfunction
Dark Physics makes any hot drink go cold.