FPS Camera Motion

Blitz3D Forums/Blitz3D Programming/FPS Camera Motion

Craig H. Nisbet(Posted 2003) [#1]
I'm writing a game in 3d that doesn't require a first person camere motions system, but I'd like to have something simple so I can fly through my geometry for testing purposes. Does anyone have some quick simple camera mouse motion code that I could use.


darklordz(Posted 2003) [#2]
U don't need us for that, check the samples u get with B3d


Stickman(Posted 2003) [#3]
Just steel the one from marks castle demo but disenable the collisions.It has good look around abuility.


Bot Builder(Posted 2003) [#4]
Here's mine in which I stole the movecam function from rob hutchison, who apparently used somthing from Si.

Global dest_xang#,dest_yang#

Graphics3d 640,480

Global cam=CreateCamera()

While Not KeyHit(1)
 If Not MouseDown(3) Then 
  movecam
  MoveEntity cam,0,0,MouseZSpeed()*2+MouseDown(1)*5+MouseDown(2)*-5 
 Else 
  MoveEntity cam,0,0,-MouseYSpeed()*2
  MoveMouse GraphicsWidth()/2,GraphicsHeight()/2
 EndIf
 UpdateWorld
 RenderWorld
Wend 

; the rest is from Rob hutchison
Function movecam()
 mxs=MouseXSpeed()/2
 mys=MouseYSpeed()/2
		
 ; Update destination camera angle x and y values
 dest_xang#=dest_xang#+mys
 dest_yang#=dest_yang#-mxs
	
 ; Curve camera angle values towards destination values
 xang#=CurveValue#(xang#,dest_xang#,5)
 yang#=CurveValue#(yang#,dest_yang#,5)
	
 RotateEntity cam,xang#,yang#,0
 MoveMouse GraphicsWidth()/2,GraphicsHeight()/2
End Function

Function CurveValue#(current#,destination#,curve)
	current#=current#+((destination#-current#)/curve)
	Return current#
End Function