(AGK version: 108.14)
Submitted: 2014-02-03 04:14:55
rem color background
setClearColor(0,0,0)

rem create sphere 0001
sphere0001=createObjectSphere(20,20,20)

rem load image
image0001=loadImage("metal.jpg")

rem texture sphere0001 with image0001
setObjectImage(sphere0001,image0001,0)

rem position the camera 80 units behind the sphere
setCameraPosition(1,0,0,-80)
setCameraRotation(1,0,0,0) // The default/initial camera angle is not x:0,y:0,z:0

`------------------------------------------------------

rem main
do

    rem rotatation counter
    inc rotCntr0001#,0.5
    if rotCntr0001#=>359.0 then rotCntr0001#=0.0

    rem rotate object on it's x axis
    rotateObjectLocalX(sphere0001,rotCntr0001#)

    rem sync
    sync()

loop
(AGK version: 108.21)
Submitted: 2014-12-14 07:58:52
// 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 box about its local X and Y axis

// create a direction light and a box to rotate (the light just makes it easier to see the box)
// the box will automatically be positioned at 0,0,0
CreateLightDirectional(1,-1,-1,1,255,255,0)
createObjectBox(1,10,10,50)

// position the light away from the box and then make the camera look at where the box is
SetCameraPosition(1,0,0,-200)
SetCameraLookAt(1,0,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()

	// rotate the box using the saved input values
	RotateObjectLocalY(1,joystick_x)
	RotateObjectLocalX(1,joystick_y)

	// print the box's angles to the screen
	print(getObjectAngleX(1))
	print(getObjectAngleY(1))
	print(getObjectAngleY(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.