| Okay, there was a coupla problems with my code. LoadMesh apparently needs complete paths or single strings, not any concatenations it seems.
 
 Anyway all fixed now :
 Graphics3D 640,480
SetBuffer BackBuffer()
SeedRnd MilliSecs()
Const fps=30
blitz=LoadFont("blitz",14,1,0,0)
SetFont blitz
ClearTextureFilters
TextureFilter "alpha",2
period=1000/fps
time=MilliSecs()-period
elapsed%=0
ticks%=0
tween#=0
rt%=0
AmbientLight 100,100,100
;Make a couple of globals to keep track of things
Global numberofmeshes=0
Global directory$=("C:\Documents and Settings\Owner\Desktop\Meshes\")
Global currentmesh=0
Global Mesh
; Make an array to store mesh filenames in.
; In  the unlikely event you have more than 99 meshes in the folder,  just change the number :) 
Dim Meshfiles$(99)
;Now populate the array with relevant mesh files (.md2, .b3d, .3ds and .x are included here for completeness)
Global folder=ReadDir(directory$)
Global file$=NextFile$(folder)
While (Not(file$=""))
	If ((Right$(Lower$(file$),4)=".md2") + (Right$(Lower$(file$),4)=".b3d") + (Right$(Lower$(file$),4)=".3ds") + (Right$(Lower$(file$),2)=".x"))
		numberofmeshes=numberofmeshes+1
		Meshfiles$(numberofmeshes)=(directory$+file$)
	End If
	file$=NextFile$(folder)
Wend
; Safety check, just in case.
If (Meshfiles$(1)="")
	RuntimeError "No Meshes In Folder "+directory$
Else
	;Default the starting mesh to number '1'
	currentmesh=1
End If
Color 100,100,100
camera=CreateCamera()
CameraZoom camera,1.6
PositionEntity camera,0,+50,-200
light=CreateLight()
;start with the default 'currentmesh' which is set to number 1
filename$=Meshfiles$(currentmesh)
Mesh=LoadMesh(filename$)
EntityColor Mesh,100,100,100
While Not KeyHit(1)
	
;right control loads the next mesh
	If KeyHit(157)
		FreeEntity Mesh 
		; Ensure we wrap-around' once the last mesh is reached. Preventing errors if we run out of meshes in the folder.
		If (currentmesh=numberofmeshes)
			currentmesh=0
		End If
		currentmesh=currentmesh+1
		filename$=Meshfiles$(currentmesh)
		Mesh=LoadMesh(filename$)
		EntityColor Mesh,100,100,100
	EndIf
	
;left control loads the previous
	If KeyHit(29)
		FreeEntity Mesh 
		; Ensure we wrap-around' once the first mesh is reached. Preventing errors if we try to go back to '0'.
		If (currentmesh=1) And (numberofmeshes>1)
			currentmesh=(numberofmeshes+1)
		End If
		currentmesh=currentmesh-1
		filename$=Meshfiles$(currentmesh)
		Mesh=LoadMesh(filename$)
		EntityColor Mesh,100,100,100
	EndIf
	PositionMesh Mesh,(KeyDown(205)-KeyDown (203)) Shl True,KeyDown(200) -KeyDown(208) Shl True, 0
	RotateMesh  Mesh, 0,KeyDown(045)-KeyDown(044), 0
							
	If KeyDown(054)
		ScaleMesh Mesh,0.9,0.9,0.9
	EndIf
							
	If KeyDown(028)
		ScaleMesh Mesh,1.1,1.1,1.1
	EndIf
							
	UpdateWorld
	RenderWorld
							
	Text 0, 0,"Controls: up down left right z x shift enter and control" 
	Text 0,15,"File: " +Right$((Meshfiles(currentmesh)),(Len(Meshfiles$(currentmesh))-Len(directory$)))
							
	Flip
	Wend
End
 
 |