Ground / floor / planes?

BlitzMax Forums/MiniB3D Module/Ground / floor / planes?

jhans0n(Posted 2008) [#1]
What do you guys do for floors and such in first person shooters and similar games? In Blitz3d, there's CreatePlane, but there's nothing like that in MiniB3D. Do you create a big cube?

I've tried creating a cube, and then stretching it to be very large (like 200x1x200, or better) but have hit some snags where it stops texturing after a certain point, or can even lose its ability to detect collisions.


JetFireDX(Posted 2008) [#2]
I haven't completed a full project yet and I am not working on a FPS but I made this a long time ago to test with and you are welcome to it. I don't know if Blitz3D makes an infinite plane, but you could certainly scale this up to a huge size or tile many of them.

Function CreatePlane:TMesh(parent_ent:TEntity=Null)

		Local mesh:TMesh=TMesh.CreateMesh(parent_ent)
	
		Local surf:TSurface=mesh.CreateSurface()
			
		surf.AddVertex(-1.0,-1.0,0.0)
		surf.AddVertex(-1.0, 1.0,0.0)
		surf.AddVertex( 1.0, 1.0,0.0)
		surf.AddVertex( 1.0,-1.0,0.0)
				
		surf.VertexTexCoords(0,0.0,1.0)
		surf.VertexTexCoords(1,0.0,0.0)
		surf.VertexTexCoords(2,1.0,0.0)
		surf.VertexTexCoords(3,1.0,1.0)
						
		surf.AddTriangle(0,1,2) ' front
		surf.AddTriangle(0,2,3)
		surf.AddTriangle(3,2,0) ' back
		surf.AddTriangle(2,1,0) ' Reveresed direction on the vertex list for the triangle to make it show when the backside is towards the camera.
		
		mesh.UpdateNormals()
		Return mesh
	
End Function