Creating Track Map

Blitz3D Forums/Blitz3D Beginners Area/Creating Track Map

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.

If you want to use only 3d commands, you could consider using a 2nd camera to record the track instead of using 2d map tiles. The round shape can be a round mesh that is textured with the map:
;-----------------------------------------------------------------------------------------------------
;											setup graphics
;-----------------------------------------------------------------------------------------------------

	Graphics3D 800, 600, 0, 2
	SetBuffer BackBuffer()
	
;-----------------------------------------------------------------------------------------------------
;											setup cameras
;-----------------------------------------------------------------------------------------------------
	;setup 1st camera
	camera = CreateCamera()
	MoveEntity camera, 0, 10, -10
	
	;setup 2nd camera
	camera2 = CreateCamera(camera)
	MoveEntity camera2, 0, 10, 0
	RotateEntity camera2, 90, 0, 0
	CameraProjMode camera2, 2
	CameraZoom camera2, 0.01
	
;-----------------------------------------------------------------------------------------------------
;											create round shape
;-----------------------------------------------------------------------------------------------------
	
	;create texture for map
	tex = CreateTexture(512, 512)
	
	;create round flat mesh
	mesh = CreateMesh()
	surf = CreateSurface(mesh)
	
	;create vertices
	AddVertex(surf, 0, 0, 0, 0.5, 0.5)
	For i = 0 To 36
	
		x# = Cos(i * 10)
		y# = Sin(i * 10)
	
		AddVertex(surf, x, y, 0, x / 2 + 0.5, y / 2 + 0.5)
		
	Next
	
	;create triangles
	For i = 0 To 36
	
		i2 = (i + 1) Mod 37 + 1
		AddTriangle surf, 0, i + 1, i2
		
	Next
	
	;flip mesh
	FlipMesh mesh
	
	;position mesh in upperleft corner of 1st camera
	PositionEntity mesh, -7.5, 15, 0
	;link to camera
	EntityParent mesh, camera
	;make full-bright
	EntityFX mesh, 1
	;scale mesh 2x
	ScaleEntity mesh, 2, 2, 2

;-----------------------------------------------------------------------------------------------------
;												create floor
;-----------------------------------------------------------------------------------------------------
	
	;create red dot texture 
	gtex = CreateTexture(32, 32)
	SetBuffer TextureBuffer(gtex)
	Color 255, 255, 0
	Rect 0, 0, 32, 32
	Color 255, 0, 0
	Oval 0, 0, 16, 16
	SetBuffer BackBuffer()
	ScaleTexture gtex, 50, 50
	
	;create ground plane
	plane = CreatePlane()
	EntityTexture plane, gtex
	
	
;-----------------------------------------------------------------------------------------------------
;												main loop
;-----------------------------------------------------------------------------------------------------

	Repeat
	
		;cursor keys to walk around
		If KeyDown(203) Then TurnEntity camera, 0, 1, 0
		If KeyDown(205) Then TurnEntity camera, 0, -1, 0
		If KeyDown(200) Then MoveEntity camera, 0, 0, +1
		If KeyDown(208) Then MoveEntity camera, 0, 0, -1
		
		;render 2nd camera onto texture "tex"
		CameraProjMode camera, 0
		CameraProjMode camera2, 2
		RenderWorld
		CopyRect 0, 0, GraphicsWidth(), GraphicsHeight(), 0, 0, BackBuffer(), TextureBuffer(tex)
		;apply "tex" to round mesh
		EntityTexture mesh, tex
		
		;render 1st camera
		CameraProjMode camera, 1
		CameraProjMode camera2, 0
		RenderWorld
		
		Flip
		
	Until KeyHit(1)
	
	End