I modified the cloth demo that came with the trial version so you can throw balls at the cloth and watch it rip apart. I think it's pretty cool, so I thought I'd share.
` shows how cloth can be torn
` set up program
autocam off
sync on
sync rate 60
color backdrop 0
set ambient light 30
position camera 0, 5, -30
make light 1
set directional light 1, -5, -5, 5
phy start
` make our ground object
make object box 1, 20, 1, 20
phy make rigid body static box 1
` attachment point for cloth
make object box 2, 6, 1, 1
position object 2, 0, 10, 0
phy make rigid body static box 2
` create our cloth
phy make cloth 3
phy set cloth dimensions 3, 5, 13, 0.2
phy set cloth position 3, 2.5, 10, 0
phy set cloth rotation 3, 135, 0, -180
phy set cloth friction 3, 0.5
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, 2, 0
objon = 50
` position camera
position camera 0.0, 5, -10
` create background sphere
load image "stripe5.png",10
make object sphere 10,400,48,48
texture object 10,10
scale object texture 10,6,6
set object cull 10,0
` texture cloth object
load image "image.png", 2
texture object 3, 2
` display Dark Physics logo
load image "logo.png", 100000
sprite 1, 0, 0, 100000
` main program loop
do
if mouseclick() and flag = 0
MakeObj(1, objon, 1, camera position x(), camera position y(), camera position z())
objon = objon + 1
flag = 1
endif
if mouseclick() = 0 then flag = 0
`Mouselook
inc Player_Xangle#, mousemovey() * 0.25
inc Player_Yangle#, mousemovex() * 0.25
position mouse 320, 240
`put a limit on how much the player can loop up/down.
if Player_Xangle# > 80.0 then Player_Xangle# = 80.0
if Player_Xangle# < -80.0 then Player_Xangle# = -80.0
rotate camera Player_Xangle#, Player_Yangle#, 0.0
` update simulation and screen
phy update
sync
loop
`This function makes our sphere object(or box if num = 2)
function MakeObj(num, obj, size, x, y, z)
if num = 1
make object sphere obj, size
position object obj, x, y, z
phy make rigid body dynamic sphere obj
else
make object cube obj, size
position object obj, x, y, z
phy make rigid body dynamic box obj
endif
`Since we have mouselook, this decides what velocity needs to be applied to move it in the direction we're looking.
x1# = camera position x() : y1# = camera position y() : z1# = camera position z()
move camera 1.0
x2# = camera position x() : y2# = camera position y() : z2# = camera position z()
move camera -1.0
unit_x# = x2# - x1#
unit_y# = y2# - y1#
unit_z# = z2# - z1#
`now, to get the initial velocity, we multiply by the throw power!
vel_x# = unit_x# * 50
vel_y# = unit_y# * 50
vel_z# = unit_z# * 50
`and apply the velocity.
phy set rigid body linear velocity obj, vel_x#, vel_y#, vel_z#
endfunction