B3D help

Blitz3D Forums/Blitz3D Beginners Area/B3D help

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.

Try this:

graphics3d 1024, 768, 32, 1
setbuffer backbuffer()

;This is just for the Freelook() function
Global campitch#,camyaw#,mvx#,mvy#,mvz#,temp#,vx#,vy#,vz#

terrain = loadmesh("terrain.b3d")
moveentity terrain, 0, -2, 3

light = createlight()

camera = createcamera()

while not keyhit(1)
  freelook(camera)
  
  UpdateWorld()
  renderworld()

  Flip
wend

Function freelook(camera)
	mxspd#=MouseXSpeed()*0.25
	myspd#=MouseYSpeed()*0.25
	MoveMouse GraphicsWidth()/2,GraphicsHeight()/2
	campitch=campitch+myspd
	If campitch<-85 Then campitch=-85
	If campitch>85 Then campitch=85
	RotateEntity camera,campitch,EntityYaw(camera)-mxspd,0
	;If KeyDown(203) Then mvx=mvx-.3
	;If KeyDown(205) Then mvx=mvx+.3
	;If KeyDown(200) Then mvz=mvz+.3
	;If KeyDown(208) Then mvz=mvz-.3
	If KeyDown(30) Then mvx=mvx-.3
	If KeyDown(32) Then mvx=mvx+.3
	If KeyDown(17) Then mvz=mvz+.3
	If KeyDown(31) Then mvz=mvz-.3
	mvx#=mvx*.8
	mvy#=mvy*.8
	mvz#=mvz*.8
	MoveEntity camera,mvx,mvy,mvz
End Function