I'm trying to simulate the effect of a ball rolling on a piece of cloth which is suspended in the air. So as the ball hits the cloth, the cloth would form around the ball slightly and stretch down slightly from the weight of the ball. I'm using a matrix for the cloth. I pretty much have the collision taken care of. But I'm not sure how to determine the correct amount to reduce the height of the matrix tiles. I'm guessing something to do with intersect object maybe?
Below is what I have so far, just to give you a better idea. DBP
sync on
autocam off
hide mouse
ox#=500
oz#=500
change = 0
make matrix 1,1000,1000,50,50
position camera 0,500,0
point camera 500,0,500
make object sphere 1,100
do
oy# = 480-mousey()
ox# = ox# + mousemovex()
position object 1,ox#,oy#,oz#
change=0
for x = 0 to 50
for z = 0 to 50
mx = x*20
mz = z*20
distance# = sqrt((mx-ox#)^2 + (get matrix height(1,x,z)-oy#)^2 + (mz-oz#)^2)
if distance# < 100.0
set matrix height 1, x, z, -100.0
change=1
else
if get matrix height(1,x,z) <> 0
`set matrix height 1, x, z, 0.0
`change=1
endif
endif
next z
next x
if change=1
update matrix 1
endif
set cursor 0,0
print distance#
sync
loop