Moving the camera around

BlitzMax Forums/BlitzMax Programming/Moving the camera around

Hi, Using miniB3D

What I have is a chessboard. Instead of the chessboard rotating I would like to move the camera around the chessboard.

Chessboard is on the x,y plane with z pointing upwards. And I want to look down onto the x,y plane.
Anyone help?

Strict
Import sidesign.minib3d

Graphics3D 1024,768,32,1

'---------------------------------------------------------------------------------------------------------------------------------------------------------------------------
'CONSTANTS
'-------------------
Const C_PA_Width:Int	= 128
Const C_PA_Depth:Int	= 128

'----------------------------------------------------------------------------------------------------------------------------------------------------------------------------
'GLOBALS
'---------------
Global G_PA_Mesh:TMesh = CreateMesh:TMesh()
Global G_PA_Surf:TSurface = CreateSurface:TSurface( G_PA_Mesh )

Global G_Sphere_Centre:TMesh = CreateSphere(8)
	ScaleEntity G_Sphere_Centre,5,5,5
	EntityColor G_Sphere_Centre, 0,255,0
	PositionEntity G_Sphere_Centre,0,0,0


Global G_Camera_Radius:Float = 256
Global G_Camera_Height:Float = 64
Global G_Camera_Rot_X:Float = 90+10
Global G_Camera_Rot_Z: Float = 0

Global G_Camera:TCamera = CreateCamera()
'-----------------------------------------------------------------------------------------------------------------------------------------------------------------------------
'INITIALISE
'---------------
For Local y:Int = 0 To C_PA_Depth
	For Local x:Int = 0 To C_PA_Depth
		G_PA_Surf.AddVertex( x-64, y-64, 0.0 )
	Next
Next

For Local y:Int = 0 To C_PA_Depth-1
	For Local x:Int = 0 To C_PA_Width-1
	
		Local a:Int = (x+0)+(y+0)*(C_PA_Width+1)
		Local b:Int = (x+1)+(y+0)*(C_PA_Width+1)
		Local c:Int = (x+1)+(y+1)*(C_PA_Width+1)
		Local d:Int = (x+0)+(y+1)*(C_PA_Width+1)
	
		G_PA_Surf.AddTriangle( a,b,c )
		G_PA_Surf.AddTriangle( a,c,d )
	Next
Next

'------------------------------------------------------------------------------------------------------
Repeat
	Local c_x# = G_Camera_Radius * Cos(G_Camera_Rot_Z#+90)
	Local c_y# = G_Camera_Radius * Sin(G_Camera_Rot_Z#+90)
	Local c_z# = G_Camera_Height#
	
	PositionEntity G_Camera, c_x#, c_y#, c_z#
	
	PointEntity G_Camera, G_Sphere_Centre
	
	G_Camera_Rot_Z# = G_Camera_Rot_Z# + 1

	RenderWorld
	
	Flip

Until KeyHit(KEY_ESCAPE)

FlushKeys()
WaitKey()
End