Sync On:Sync Rate 60:Autocam Off
 
Make Matrix 1,40,40,4,4
 
Make Object Cube 1,1
Make Mesh From Object 1,1
Add Limb 1,1,1
Offset Limb 1,1,0,0,30
Position Camera 10,20,-30
Point Camera 20,0,30
Make Object Sphere 2,.5
Make Object Sphere 3,.5
Make Object Sphere 4,.5
Make Object Sphere 5,.5
For i = 2 to 5
   Color Object i,rgb(0,255,0)
Next i
Make Object Plain 6,1,1
Make Object Cube 7,1
Make Object Cylinder 10,1
Scale Object 10,10,1400,10
Position Object 10,0,7,0
Set Text Font "Ariel"
Set Text Size 12
ax#=0
ay#=0
 
Do
   ay#=WrapValue(ay#+RightKey()-LeftKey())
   ax#=WrapValue(ax#+UpKey()-DownKey())
   Rotate Object 1,ax#,ay#,0
   lx#=Limb Position X(1,1)
   ly#=Limb Position Y(1,1)
   lz#=Limb Position Z(1,1)
   Position Object 2,lx#,0,lz#
   Position Object 3,lx#,0,0
   Position Object 4,0,ly#,0
   Position Object 5,0,0,lz#
   Delete Object 6
   Make Object Plain 6,lx#,lz#
   Color Object 6,Rgb(255,0,0)
   Set Alpha Mapping on 6,70
   Pitch Object Down 6,90
   Position Object 6,lx#/2.0,0,lz#/2.0
   Delete Object 7
   Make Object Triangle 7,0,0,0,lx#,ly#,lz#,lx#,0,lz#
   Color Object 7,Rgb(0,255,0)
   Ghost Object On 7
   Set Cursor 0,0
   Print "Angle X:";Object Angle X(1)
   Print "Angle Y:";Object Angle Y(1)
   Print "Angle Z:";Object Angle Z(1)
   Print "Calculated Angle X:"; WrapValue(360-ATANFULL(ly#,Sqrt(lx#*lx#+lz#*lz#)))
   Print "WrapValue(360-ATANFULL(ly#,Sqrt(dx#*dx#+dz#*dz#)))"
   Print
   Print "Calculated Angle Y:"; Int(WrapValue(ATANFULL(lx#,lz#))+.499)
   Print "WrapValue(ATANFULL(dx#,dz#))"
   Print
   Print "Calculated Angle Z:"; 0
   Sync
Loop