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
|