Hi all,
A short clip of the cloth system in Dark Physics, just a slight mod to the original demo, setting the tear properties and making it longer. The video is deliberately slower than it would usually be, so as you can see it working properly.
Vid: (7mb)
http://forum.thegamecreators.com/xt/xt_apollo_download.php?i=959624
Save this in the same dir as the original cloth ball demo.
`Modified to allow tearing
` shows how a cloth and ball react together
` set up program
phy start
sync on
sync rate 60
autocam off
color backdrop 0
` make attachment object
make object box 1,10,2,2
phy make rigid body static box 1
` create floor
make object box 2,50,1,50
color object 2,rgb(125,125,125)
position object 2,0,-9,0
phy make rigid body static box 2
load image "mediastripe6.png",2
texture object 2,2
` create background sphere
load image "mediastripe5.png",10
make object sphere 10,400,48,48
texture object 10,10
scale object texture 10,6,6
set object cull 10,0
rotate object 10,0,0,90
` create the cloth object
phy make cloth 3
`*** longer cloth
phy set cloth dimensions 3, 10,20,0.4
phy set cloth position 3, -5, 0, 0
phy set cloth friction 3, 0.5
`*** added tearing
phy set cloth tearing 3, 1
phy set cloth tear factor 3, 2.2
phy set cloth bending 3, 1
phy set cloth two way collision 3, 1
phy build cloth 3
phy attach cloth to shape 3, 1, 1
color object 3,rgb(125,125,255)
load image "mediarug512.bmp", 3
texture object 3, 3
disable object zwrite 3
` set up our ball object
make object sphere 4,5
color object 4,rgb(255,0,0)
position object 4,0,-5,1
set object ambient 4, 0
phy make rigid body dynamic sphere 4
` display Dark Physics logo
load image "medialogo.png",1000
sprite 1, 0, 600-60, 1000
set sprite 1, 0, 1
hide sprite 1
` position the camera
position camera 0,10,30
rotate camera 0,180,0
point camera 0,0,0
` our main program loop
do
` display instructions
text 10,10, "Rigid body and cloth, use the arrow keys to move the ball"
` move ball around
if upkey()=1 then phy set rigid body linear velocity 4, 0, 0, -8
if downkey()=1 then phy set rigid body linear velocity 4, 0, 0, 8
if leftkey()=1 then phy set rigid body linear velocity 4, 8, 0, 0
if rightkey()=1 then phy set rigid body linear velocity 4, -8, 0, -0
` update simulation and screen
phy update
sync
loop
Aegrescit medendo