Modulabe exterior
Blitz3D Forums/Blitz3D Programming/Modulabe exterior
| ||
How can i do to dig some hole on the ground and perhaps some tunnel for a rpg game.. I'd tried via addvertex but i can't see the light's render.... |
| ||
Say what? |
| ||
what? |
| ||
I'd like to create floor in a rpg that i can dig... My ideas are -with addvertex but it don't render the light -with terrain and image but i can't have holes to create tunnels -Or with a lot of cube wich could be too dificult to render |
| ||
Most likely because the vertex normals are pointing the wrong way. Use UpdateNormals mesh after you add the hole. |
| ||
Wont work Graphics3D 800,600,16,0 SetBuffer BackBuffer() ;*---------------------- ;| OPTION | ;----------------------- mapw=800 maph=800 Const tile=10 Dim map(mapw,maph,2) ;0 pour vertex, 1 pour z, 2 ;-------------------------< p=CreatePivot() cam=CreateCamera(p) PositionEntity p,0,0,0 l=CreateLight(2) PositionEntity l,0,0,-200 ground=CreateMesh() surf=CreateSurface(ground) TurnEntity ground,-180,0,0 PositionEntity ground,0,200,10 For gx=1 To mapw Step tile For gy=1 To maph Step tile map(gx,gy,1)=Rand(20) map(gx,gy,0)=AddVertex(surf,gx,gy,map(gx,gy,1)) Next Next For gx=1 To mapw-tile Step tile For gy=1 To maph-tile Step tile AddTriangle(surf,map(gx,gy,0),map(gx+tile,gy,0),map(gx+tile,gy+tile,0)) AddTriangle(surf,map(gx,gy+tile,0),map(gx,gy,0),map(gx+tile,gy+tile,0)) Next Next tex=LoadTexture ("texture/bison.bmp") Print tex EntityTexture ground,tex Rect 0,50,256,20 SetBuffer BackBuffer() While Not KeyHit(1) TurnEntity l,0,1,0 fps=MilliSecs() If KeyDown(200) Or MouseDown(3) Then MoveEntity p,0,2,0 ElseIf KeyDown(208) Then MoveEntity p,0,-2,0 EndIf If KeyDown(205) Then MoveEntity p,2,0,0 ElseIf KeyDown(203) Then MoveEntity p,-2,0,0 EndIf If KeyDown(77) Or MouseDown(3) Then MoveEntity p,0,0,2 ElseIf KeyDown(81) Then MoveEntity p,0,0,-2 EndIf mx=mx+MouseXSpeed() my=my+MouseYSpeed() RotateEntity p,0,0,-mx RotateEntity cam,my,0,0 RenderWorld Text 0,0,"Fps: "+(MilliSecs()-fps) MoveMouse 400,300 Flip Wend Also i'd like to know how to texture triangle/triangle if it's possible. Where must i put UPDATENORMALS mesh? Thanks anyway... |
| ||
Where must i put UPDATENORMALS mesh? Anytime the mesh is modified. You might want to put one right after you create the triangles, then in your code whenever you add a hole by adding more vertexes and triangles, you use UpdateNormals ground. Here is a program I wrote that modifies a mesh. It doesn't create holes, but might give you an idea of the proper way to use UpdateNormals. [Edit to Add] Try commenting out the UpdateNormals command in the code and notice how it affects the lighting. [edited again cause I misspelled "quote" on the quote tag :)] |
| ||
OH YEAH great, man, gratz, it's cool, thank you very much |