I'm trying to use a variation of the Dynamic Shadow code from jfk. I have created a mesh grid to map the shadow to using the following code :
I have a pickable terrain (currently the only pickable object other than bullets) held in the type 'Terrain\ObjectHandle'. I set the pickmode to 2 (polygon). Then, in the game loop I'm calling the InTouch function for each "Shadow" in view/range to update the vertices height using the following code:
The thing is that the towel mesh doesn't change. It remains flat as you can see in the screenshots.. The white plane below the player is the towel mesh:
Screenshot 1
Screenshot 2
Screenshot 3
Can anyone help me with this? I can't figure out why the verts aren't changeing height. BTW: The grid in this example is 10x10.
Function CreateShadowGrid(Player.T_Player) Player\ShadowHandle = CreateMesh() Player\ShadowSurf = CreateSurface(Player\ShadowHandle) Player\TotalVerts = Player\ShadowGridSize ^ 2 ; Builds Vertex Grid and sets UV coordinates For z# = 0 To Player\ShadowGridSize-1 For x# = 0 To Player\ShadowGridSize-1 AddVertex(Player\ShadowSurf, x#, 0, z#, x#/(Player\ShadowGridSize-1), z#/(Player\ShadowGridSize-1)) Next Next For z# = 0 To Player\ShadowGridSize - 2 For x# = 0 To Player\ShadowGridSize - 2 v1# = (Player\ShadowGridSize * z#) + x# v2# = v1# + 1 v3# = v1# + Player\ShadowGridSize v4# = v3# + 1 AddTriangle(Player\ShadowSurf, v1#, v2#, v3#) AddTriangle(Player\ShadowSurf, v2#, v4#, v3#) Next Next UpdateNormals Player\ShadowHandle RotateMesh Player\ShadowHandle, 0,0,180 End Function
I have a pickable terrain (currently the only pickable object other than bullets) held in the type 'Terrain\ObjectHandle'. I set the pickmode to 2 (polygon). Then, in the game loop I'm calling the InTouch function for each "Shadow" in view/range to update the vertices height using the following code:
Function Intouch(Player.T_Player) For count = 0 To Player\totalVerts-1 vx# = VertexX(Player\Shadowsurf,count) vz# = VertexZ(Player\Shadowsurf,count) picker = LinePick(vx#, 500, vz#, 0, -1000, 0, .01) If picker<>0 Then vy# = PickedY#()+0.1 Else Stop EndIf VertexCoords Player\Shadowsurf, count, vx#, vy#, vz# Next UpdateNormals Player\ShadowHandle End Function
The thing is that the towel mesh doesn't change. It remains flat as you can see in the screenshots.. The white plane below the player is the towel mesh:
Screenshot 1
Screenshot 2
Screenshot 3
Can anyone help me with this? I can't figure out why the verts aren't changeing height. BTW: The grid in this example is 10x10.