Posted: 6th Apr 2004 22:58
This will gradually rotate an object from one rotation to another. You specify how many frames it takes to complete its rotation.

+ Code Snippet
sync on
sync rate 60
autocam off

rem number of frames for rotation to complete
frames# = 50

rotX# = 50
roty# = 230
rotz# = 220

rotX2# = 300
rotY2# = 65
rotZ2# = 30

incX# = (rotX2#-rotX#)/frames#
incY# = (rotY2#-rotY#)/frames#
incZ# = (rotZ2#-rotZ#)/frames#


rx# = rotX#
ry# = rotY#
rz# = rotZ#

rotating = 500


make object cone 1, 20
xrotate object 1, 90
fix object pivot 1

rotate object 1, rotX#, rotY#, rotZ#
position camera 0,50,-400
point camera 0,0,0

do

  if spacekey()
      rotating = 0
      rx# = rotX#
      ry# = rotY#
      rz# = rotZ#
  endif

  if rotating <= frames#
      rotate object 1, rx#, ry#, rz#
      move object 1, 2
      rx# = wrapvalue(rx# + incX#)
      ry# = wrapvalue(ry# + incY#)
      rz# = wrapvalue(rz# + incZ#)
      inc rotating, 1
  endif

  sync
loop