I follow your idea Latch, I just have a few prolbmes when implementing it. First, the 'feeler' won't jump with my sphere, it stays on the same y-unit the whole way through, so if I try and make the shadow appear on higher or lower platforms, it doesn't work.
The second problem is that the feeler isn't aligned with my sphere properly. It's offset by a unit or so. Instead of hiding the feeler object (which is just a long box)I just ghosted it so that I could see what it was doing. That's how I discovered that problem.
The third is that the shadow will only disappear 50% of the time over gaps, which is odd.
Here's my code, with your idea implemented...
set display mode 800,600,32
sync on
sync rate 65
autocam off
Hide Mouse
cls rgb(255,255,255)
ink rgb(100,100,100),0
for r=0 to 32
circle 33,33,r
circle 33,32,r
next r
get image 1,0,0,66,66
sync
Rem make shadow plain
make object plain 2,1,1
texture object 2,1
ghost object on 2,1
position object 2,0,-1,0
xrotate object 2,90
Rem make sphere
make object sphere 1,.6
position object 1,0,3,0
set object collision on 1
make object collision box 1,-.5,-.5,-.5,.5,.5,.5,0
Rem make a 'feeler' and use it to guide the shadow
Make object box 10,1,20,1 : Position object 10,0,-1,0
set object collision on 10
make object collision box 10,-.5,-5,-.5,.5,5,.5,0
`Hide object 10
Ghost object on 10
Rem make platforms to test out shadow
Make object box 3,5,5,5 : Position object 3,0,-1,0 : Color object 3,rgb(255,0,128) : Ghost object on 3
Set object collision on 3
Make object collision box 3,-2.5,-2.5,-2.5,2.5,2.5,2.5,0
Make object box 4,5,5,5 : Position object 4,10,-1,0 : Color object 4,rgb(90,255,12) : Ghost object on 4
Set object collision on 4
Make object collision box 4,-2.5,-2.5,-2.5,2.5,2.5,2.5,0
Make object box 5,5,5,5 : Position object 5,10,-1,5 : Color object 5,rgb(0,234,234) : Ghost object on 5
Set object collision on 5
Make object collision box 5,-2.5,-2.5,-2.5,2.5,2.5,2.5,0
Make object box 6,5,5,5 : Position object 6,10,-1,15 : Color object 6,rgb(55,34,234) : Ghost object on 6
Set object collision on 6
Make object collision box 6,-2.5,-2.5,-2.5,2.5,2.5,2.5,0
make object box 7,5,5,5 : Position object 7,10,-1,20 : Color object 7,rgb(250,0,255) : Ghost object on 7
Set object collision on 7
Make object collision box 7,-2.5,-2.5,-2.5,2.5,2.5,2.5,0
Rem ===============MAIN LOOP===============
Do
`----------------------------
`Draw Shadow Routine
`----------------------------
`Draw Shadow for lower units
if object collision(10,0) then position object 2, object position x(1), object position y(10)+2.5, object position z(1) : show object 2 : else hide object 2
`controls
if upkey()=1 then move object 1,0.23
if downkey()=1 then move object 1,-0.23
if leftkey()=1 then yrotate object 1,wrapvalue(object angle y(1)-1.5)
if rightkey()=1 then yrotate object 1,wrapvalue(object angle y(1)+1.5)
if controlkey()=1 and playergrav#=0 then playergrav#=0.35
if upkey()=1 then move object 2,0.23
if downkey()=1 then move object 2,-0.23
if upkey()=1 then move object 10,0.23
if downkey()=1 then move object 10,-0.23
if leftkey()=1 then yrotate object 10,wrapvalue(object angle y(10)-1.5)
if rightkey()=1 then yrotate object 10,wrapvalue(object angle y(10)+1.5)
`get current object position
posx#=object position x(1)
posy#=object position y(1)
posz#=object position z(1)
`gravity
playergrav#=playergrav#-0.01
posy#=posy#+playergrav#
`sliding collision
position object 1,posx#,posy#,posz#
if object collision(1,0)>0
dec posx#,get object collision x()
dec posy#,get object collision y()
dec posz#,get object collision z()
playergrav#=-0.0
endif
`set size for controlled object
s#=object size y(1)/2.0
`update with new object position
position object 1,posx#,posy#,posz#
`camera
angle#=object angle y(1)
camdist#=10.5 : camhigh#=posy#+2.5 : camfade#=12.5
set camera to follow posx#,posy#,posz#,angle#,camdist#,camhigh#,camfade#,1
xrotate camera 10
`end loop
sync
loop
It's an ingenious idea you have. I just wish I were smart enough to solve the little problems myself. Sometimes I feel like I'm abusing the use of the DBC boards.
Check out my programming blog!