Hello JoshW,
Now I haven't tried this idea out, it just came to me after I read your post.
If you are only worried about a matrix as the ground and a cylinder, you wouldn't necessarily need sliding collision. You could basically use GET GROUND HEIGHT (of the matrix) to determine what happens between the cylinder and the matrix.
The theory is something like this:
You need to know the size of the cylinder. You should make an invisible cone that the cylinder sits on top of dead center of the cylinder. The matrix should be larger that the cylinder, but it doesn't have to be.
With me so far? Ok, if the matrix is bumpy, it will have varying heights (y values) at different locations. The key is to use GET GROUND HEIGHT for whereever the cylinder is at any given time, and based on the height from the center of the cylinder or at either end, rotate the cylinder more the higher the ground is at a specific end, and if it's higher in the middle, raise the cylinder up on the y axis. It would be helpful to position or rather attach the cylinder on top of an invisible cone that serves as the pivot point.
You move the cone down the matrix (with the cylinder attached to it) and pivot (rotate) the cylinder either end as the ground height changes. Then if the ground height goes up directly under the center of the cylinder (the cone) you raise the whole apparatus.
I mentioned you need to know the size of the cylinder - that is so you can calculate the ground height from the center (the cone) of the cylinder to either end.
Does this make any sense?
Now that I've written this, maybe I'll throw together a demo of what I'm talking about.
[EIDT]
Ok, I've created the demo. I didn't use the pivot cone, I didn't actually need it for this demo. This example pretty much fits the bill of what I was talking about. You can make it more complex to suit your needs - account for the cylinder changing angles, changing slopes and speeds, etc.
`rolling cylinder
` by latch grapple
` 2/13/2007
set display mode 800,600,32
sync on
sync rate 60
randomize timer()
autocam off
rem =============================================================
rem = Make matrix with bumps
rem =============================================================
matx=1000
matz=1000
tilex=25
tilez=25
make matrix 1,matx,matz,tilex,tilez
randomize matrix 1,20
update matrix 1
rem =============================================================
rem = Make a cylinder
rem =============================================================
rem get an image to texture cylinder so we can see it roll
box 5,5,10,10
get image 1,0,0,16,16
rem create object
make object cylinder 1,100
zrotate object 1,270
fix object pivot 1
scale object 1,100,50,50
x#=rnd(1000-50)+50
z#=0
y#=get ground height(1,x#,z#)+50
position object 1,x#,y#,z#
texture object 1,1
rem =============================================================
rem = Initial camera position
rem =============================================================
position camera matx/2,500,-500
point camera matx/2,0,matz/2
rem =============================================================
rem = Main Loop
rem =============================================================
do
z#=z#+2
position object 1,object position x(1),object position y(1),z#
rem get the ground heights for the sides and center of cylinder
lefty#=get ground height(1,object position x(1)-50,object position z(1)-50)
righty#=get ground height(1,object position x(1)+50,object position z(1)+50)
centery#=get ground height(1,object position x(1),object position z(1))
rem let's make the cyl rotate forward so it looks like it's rolling
xang#=wrapvalue(xang#+7)
xrotate object 1,xang#
rem pivot and raise cylinder
zrotate object 1,wrapvalue(righty#-lefty#)
position object 1,object position x(1),centery#+50,object position z(1)
rem reset position and roll cylinder again
if object position z(1) >= 900 or object position z(1) < 0
x#=rnd(1000-50)+50
z#=0
y#=get ground height(1,x#,z#)+50
position object 1,x#,y#,z#
endif
text 0,0,str$(screen fps())
sync
loop
Enjoy your day.