devils shadow system

Blitz3D Forums/Blitz3D Userlibs/devils shadow system

The forum is locked. These are the original blitzbasic.com forums, kept so they can still be read. No new topics, replies or edits can be made here. To join in, head over to the Blitz3D+ forums.

ok i'm new to this shadow system and i'm having some issues.
first i get some very weird z-order like issue. also if i use setshadowmesh on my cube character it no longer participates in collisions. heres the code.
Function loadlevel()
MaskImage mouseim,0,0,0
Repeat 
Cls
DrawImage backim,0,0
DrawImage L1im,280,300
DrawImage mouseim,MouseX(),MouseY()
If ImagesOverlap (mouseim,MouseX(),MouseY(),L1im,280,300) And MouseHit(1)
levelnum=1
Exit
End If 
Flip
Until KeyHit(1)
Select levelnum
Case levelnum=1
Cls
loadlevel1()
Case levelnum=2
Return
End Select
End Function

Function loadlevel1()
InitShadows(cam)
Light=CreateShadowLight(3)
level=LoadShadowMesh("lev1.b3d", False)
UpdateNormals level
bounds=CopyEntity(level)
FlipMesh bounds
EntityType bounds,world
Restore level1data
Read goodienum
 For q=1 To goodienum
	 Read x
	 Read y
	 Read z
	 g.gbox=New gbox
	 g\x=x
	 g\y=y
	 g\z=z
	 g\e=CreateCube()
	 EntityAlpha g\e,.4
	 EntityTexture g\e,goodietex
	 PositionEntity g\e,g\x,g\y,g\z
	 EntityType g\e,goodie
 Next
EntityType level,world
End Function

Function updatecam()
dx#=(TFormedX()-EntityX(cam))*.08
dy#=(TFormedY()-EntityY(cam))*.01
dz#=(TFormedZ()-EntityZ(cam))*.08

TranslateEntity cam,dx,dy,dz

End Function

Function loadplayer()
c.char=New char
c\e=CreateCube()
SetShadowMesh(c\e,True,"cube.shd")
c\x=0
c\y=1
c\z=0
PositionEntity c\e,c\x,c\y,c\z
EntityType c\e,player
EntityParent itempiv,c\e
End Function

Function updatelevel()
For g.gbox=Each gbox
 TurnEntity g\e,.5,.5,.5

 For c.char=Each char
  If EntityCollided(c\e,goodie)
   HideEntity g\e
   c\i=g\i
  End If
 Next

 g\time=g\time+1
 If g\time>120 g\time=0
 If g\time=120 
  SeedRnd MilliSecs()
  ShowEntity g\e
  g\i=Rnd(5)
 End If 
Next
End Function

Function updateplayer()
For c.char= Each char
 TFormPoint 0,2,-4,c\e,0
 PointEntity cam,c\e
 If KeyDown(200)
  MoveEntity c\e,0,0,1
 ElseIf KeyDown(208)
  MoveEntity c\e,0,0,-1
 ElseIf KeyDown(203)
  TurnEntity c\e,0,1,0
 ElseIf KeyDown(205)
  TurnEntity c\e,0,-1,0
 EndIf
 LinePick EntityX(c\e),EntityY(c\e),EntityZ(c\e),0,-10,0
 AlignToVector c\e,PickedNX(),PickedNY(),PickedNZ(),2
 MoveEntity c\e,0,gravity,0
;ITEMS
 ;Select c\i
 ;Case c\i=1
 ; i.item=New item
 ; i\e=CreateSphere(8,itempiv)
 ; MoveEntity i\e,0,0,-2;        i'm still working on this
 ; EntityColor i\e,0,255,0
 ;End Select
 Next
End Function