rem
rem AGK Application 2.0.21
rem MR
setdisplayaspect(320/480.0)
setvirtualresolution(320,480)
setclearcolor(0,0,125)
SetSunActive ( 1 )
SetSunColor ( 255,255,255 )
SetSunDirection ( 0,-1,1 )
CreateObjectcone( 1, 3,3,3 )
setobjectcolor(1,125,125,0,255)
SetObjectposition( 1,0,0,5 )
setcameraposition(1,0,0,-5)
setcameralookat(1,0,0,5,0)
do
//axis
ax#=0.0
ay#=1.0
az#=0.0
//angle in degree
theta# = theta# + 1.0
w# = cos(theta#)
x# = ax# * sin(theta#)
y# = ay# * sin(theta#)
z# = az# * sin(theta#)
SetObjectRotationQuat( 1, w#,x#,y#,z# )
sync()
loop
rem Fix the example above : divide the degree by 2
rem Comparation between 2 functions, SetObjectRotationQuat and SetObjectRotation
//setdisplayaspect(320/480.0)
//setvirtualresolution(320,480)
SetSyncRate(5, 0)
setclearcolor(0,0,125)
SetSunActive ( 1 )
SetSunColor ( 255,255,255 )
SetSunDirection ( 0,-1,1 )
CreateObjectBox( 1, 3,3,3 )
setobjectcolor(1,125,125,0,255)
SetObjectposition( 1,-5,0,5 )
CreateObjectBox( 2, 3,3,3 )
setobjectcolor(2,125,0,0,255)
SetObjectposition( 2, 0,0,0 )
setcameraposition(1,-10,0,-5)
setcameralookat(1,0,0,5,0)
do
//axis
ax#=0.0
ay#=0.0
az#=1.0
//angle in degree
theta# = theta# + 1.0
w# = cos(theta#/2)
x# = ax# * sin(theta#/2)
y# = ay# * sin(theta#/2)
z# = az# * sin(theta#/2)
SetObjectRotationQuat( 1, w#,x#,y#,z# )
SetObjectRotation(2, 0, 0, theta#)
print("theta#: " + str(theta#))
print("Box 1: " + str(GetObjectAngleZ(1)))
print("Box 2: " + str(GetObjectAngleZ(2)))
sync()
loop
rem rem AGK Application 1.08 19 rem MR setdisplayaspect(320/480.0) setvirtualresolution(320,480) setclearcolor(0,0,125) createlightdirectional(1,0,-1,1,255,255,255) CreateObjectcone( 1, 3,3,3 ) setobjectcolor(1,125,125,0,255) SetObjectposition( 1,0,0,5 ) setcameraposition(1,0,0,-5) setcameralookat(1,0,0,5,0) do //axis ax#=0.0 ay#=1.0 az#=0.0 //angle in degree theta# = theta# + 1.0 w# = cos(theta#) x# = ax# * sin(theta#) y# = ay# * sin(theta#) z# = az# * sin(theta#) SetObjectRotationQuat( 1, w#,x#,y#,z# ) sync() loop