(AGK version: 108.21)
Submitted: 2014-12-14 14:19:38
// note: this example should work with AGK 108.21 onward and AGK V2

// use the wasd keys or the on screen joystick
// to rotate the camera about its local X and Y axis
// this can be a little disorientating

// create a direction light and some boxes to act as a "map"
// CreateLightDirectional(1,-1,-1,1,255,255,255)
for i = 1 to 4
        createObjectBox(i,20,500,20) //create the box
next i

// color and position position the boxes
SetObjectColor(1,255,255,255,255)
setObjectPosition(1,0,0,150)  //in front of the camera
SetObjectColor(2,255,0,0,255)
setObjectPosition(2,150,0,0)  //to the right of the camera
SetObjectColor(3,0,255,0,255)
SetObjectPosition(3,0,0,-150)  //behind the camera
SetObjectColor(4,0,0,255,255)
SetObjectPosition(4,-150,0,0)  //to the left of the camera

// set the camera's initial position and rotation
SetCameraPosition(1,0,0,0)
SetCameraRotation(1,0,0,0)

// main loop
do

        // player input using the joystick commands so this demo will work on a keyboard or a touch screen
        joystick_x = GetJoystickX()
        joystick_y = GetJoystickY()

        // reset the camera's rotation to zero by pressing spacebar or the on screen button
        if getButtonPressed(1) =1
                SetCameraRotation(1,0,0,0)
        endif

        // rotate the camera
        RotateCameraLocalY(1,joystick_x)
        RotateCameraLocalX(1,joystick_y)

        // print the box's angles to the screen
        print(getCameraAngleX(1))
        print(getCameraAngleY(1))
        print(getCameraAngleZ(1))

        sync()
loop
(AGK version: 2.0.19)
Submitted: 2016-06-10 06:34:04
//AGK 2.0.19
//Rotate Camera local via Button clicks

#option_explicit

SetVirtualResolution(100,100)

SetClearColor(0,64,0)

local box
box=CreateObjectBox(1,1,1)

SetObjectPosition(box,0,0,5)

SetCameraPosition(1,0,0,0)
SetCameraRotation(1,0,0,0)

AddVirtualButton(1,5,5,10)
SetVirtualButtonText(1,"X")

AddVirtualButton(2,15,5,10)
SetVirtualButtonText(2,"Y")

AddVirtualButton(3,25,5,10)
SetVirtualButtonText(3,"Z")

AddVirtualButton(4,35,5,10)
SetVirtualButtonText(4,"-X")

AddVirtualButton(5,45,5,10)
SetVirtualButtonText(5,"-Y")

AddVirtualButton(6,55,5,10)
SetVirtualButtonText(6,"-Z")

AddVirtualButton(7,65,5,10)
SetVirtualButtonText(7,"0,0,0")

do
		
	if GetVirtualButtonPressed(1)
		RotateCameraLocalX(1,5)
	endif
	if GetVirtualButtonPressed(2)
		RotateCameraLocalY(1,5)
	endif
	if GetVirtualButtonPressed(3)
		RotateCameraLocalZ(1,5)
	endif

	if GetVirtualButtonPressed(4)
		RotateCameraLocalX(1,-5)
	endif
	if GetVirtualButtonPressed(5)
		RotateCameraLocalY(1,-5)
	endif
	if GetVirtualButtonPressed(6)
		RotateCameraLocalZ(1,-5)
	endif

	if GetVirtualButtonPressed(7)
		SetCameraRotation(1,0,0,0)
	endif
	
	sync()
	
loop
end


Help make AGK better by submitting an example for this command!
(All examples are subject to approval)
Login to post an example of your own.