Code: Alles auswählen
; Autor: OstA (http://thommy-oster.de.vu)
Global CameraRotationX; Global um später Schussrichtung zu bestimmen
Global CameraRotationZ
Procedure.f GSin(winkel.f)
ProcedureReturn Sin(winkel*(2*3.14159265/360))
EndProcedure
Procedure.f GCos(winkel.f)
ProcedureReturn Cos(winkel*(2*3.14159265/360))
EndProcedure
Procedure CamRotate()
ExamineMouse()
x = MouseDeltaX()
y = MouseDeltaY()
If x <> 0
CameraRotationZ - x
If CameraRotationZ > 359
CameraRotationZ = CameraRotationZ-360
ElseIf CameraRotationZ <= 0
CameraRotationZ = 360-CameraRotationZ
EndIf
EndIf
If y <> 0
CameraRotationX - y
If CameraRotationX > 179
CameraRotationX = 179
ElseIf CameraRotationX < 1
CameraRotationX = 1
EndIf
EndIf
CameraLookAt(0, CameraX(0)-10*GCos(CameraRotationZ)*GSin(CameraRotationX), CameraY(0)-10*GSin(CameraRotationZ)*GSin(CameraRotationX), CameraZ(0)-10*GCos(CameraRotationX))
EndProcedure