REM ***********************************************
REM Title: 3D Rotation
REM Author: Dmitry
REM Downloaded from: http://dbcc.zimnox.com/
REM ***********************************************
 
REM Dmitry
 
Make Object Sphere 2, 1.0
Make Object Sphere 1, 1.0
Sync Rate 0
Sync On
XAngle#=0.0
YAngle#=0.0
ZAngle#=0.0
Dist#=10.0
Position Camera Object Position X(1), Object Position Y(1), Object Position Z(1)-50.0
Do
  Set Cursor 0, 0
  Print "Angle X = ", XAngle#, " +/- keys 7/9"
  Print "Angle Y = ", YAngle#, " +/- keys 4/6"
  Print "Angle Z = ", ZAngle#, " +/- keys 1/3"
  Print "Dist# = ", Dist#, " +/- keys 8/2"
  If Inkey$()="7" Then XAngle#=WrapValue(XAngle#+1.0)
  If Inkey$()="9" Then XAngle#=WrapValue(XAngle#-1.0)
  If Inkey$()="4" Then YAngle#=WrapValue(YAngle#+1.0)
  If Inkey$()="6" Then YAngle#=WrapValue(YAngle#-1.0)
  If Inkey$()="1" Then ZAngle#=WrapValue(ZAngle#+1.0)
  If Inkey$()="3" Then ZAngle#=WrapValue(ZAngle#-1.0)
  If Inkey$()="8" Then Inc Dist#, 0.5
  If Inkey$()="2" Then Dec Dist#, 0.5
  X#=(Cos(ZAngle#)*Sin(YAngle#)*Sin(XAngle#)-Sin(ZAngle#)*Cos(XAngle#))*Dist#
  Y#=(Cos(ZAngle#)*Cos(XAngle#)+Sin(ZAngle#)*Sin(YAngle#)*Sin(XAngle#))*Dist#
  Z#=(Cos(YAngle#)*Sin(XAngle#))*Dist#
  Position Object 2, Object Position X(1)+X#, Object Position Y(1)+Y#, Object Position Z(1)+Z#
  Sync
Loop