(AGK version: 108.24)
Submitted: 2015-01-02 17:48:39
// this example should work with AGK V1 and V2

// use the wasd keys or the onscreen joystick to rotate the cone
// a red sphere will be placed on the tip of the cone no matter the cone's orientation

// make a green cone and position it
CreateObjectCone(1,40,30,20)
SetObjectColor(1,0,255,0,255)
SetObjectPosition(1,0,70,0)

// create a red sphere
CreateObjectSphere(2,10,20,20)
SetObjectColor(2,255,0,0,255)

// create plane and rotate it to make a floor
CreateObjectPlane(3,500,500)
SetObjectRotation(3,90,0,0)

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

// position and orientate camera
SetCameraPosition(1,0,150,-200)
SetCameraLookAt(1,0,70,0,0)

do

	// get player input
	joystick_x = GetJoystickX()
	joystick_y = GetJoystickY()

	// rotatet the cone based on player input
	RotateObjectLocalZ(1,joystick_x)
	RotateObjectLocalX(1,joystick_y)

	// position the red sphere at the tip of the cone
	SetobjectPosition(2,GetObjectX(1),GetObjectY(1),GetObjectZ(1))
	SetObjectRotation(2,GetObjectAngleX(1),GetObjectAngleY(1),GetObjectAngleZ(1))
	MoveObjectLocalY(2,20)

	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.