(AGK version: 108.24)
Submitted: 2014-12-19 18:29:51
// note: this demo should work in AGk V1 and V2

// use wasd keys or the on screen joystick to move and turn the camera

// make a floor from a grid of planes
i = 0
for z = 0 to 6
	for x = 0 to 6
		inc i
		CreateObjectPlane(i,50,50)
		SetObjectRotation(i,90,0,0)
		SetObjectColor(i,75,75,random(100,255),255)
		SetObjectPosition(i,(x-3)*50,0,(z-3)*50)
	next x
next z

// create a directional light
CreateLightDirectional(1,-1,-1,1,255,255,255)

// position the camera and have it look at the centre of the "map"
SetCameraPosition(1,0,5,0)
SetCameraRotation(1,0,0,0)

do

        // get the position of the pointer (mouse)
        joystick_x# = GetJoystickX()
        joystick_y# = GetJoystickY()

		// turn and move the camera based on the play input
		RotateCameraGlobalY(1,joystick_x#*1.5)
		MoveCameraLocalZ(1,joystick_y#*-1.5)

		// print the camera's coordinates to the screen
		print("position")
		Print(GetCameraX(1))
		Print(GetCameraY(1))
		Print(GetCameraZ(1))

        sync()

loop


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.