Posted: 26th Sep 2003 22:47
Tool Panel.

+ Code Snippet
ViewMatrix=100
Vector=1
LastSelected=1

r=Make Matrix4(ViewMatrix)
r=Make Vector3(Vector)
Dim Text$(6)
Text$(1)="CUBE"
Text$(2)="BOX"
Text$(3)="SPHERE"
Text$(4)="CYLINDER"
Text$(5)="CONE"
Text$(6)="PLANE"


Autocam Off

Make Object Cube 1, 2
Disable Object ZDepth 1
Make Object Box 2, 2, 1, 1
Disable Object ZDepth 2
Make Object Sphere 3, 2
Disable Object ZDepth 3
Make Object Cylinder 4, 2
Disable Object ZDepth 4
Make Object Cone 5, 2
Disable Object ZDepth 5
Make Object Plain 6, 2, 1
Disable Object ZDepth 6

For i=100 To 150
   Make Object Cube i, 10
   Position Object i, RND(1000)-500, RND(1000)-500, RND(1000)-500
Next i

Sync Rate 0
Sync On

Do
   Control Camera Using Arrowkeys 0, 5, 5
   Gosub LockPanelTools
   If MouseClick() Then Gosub SelectTool
   Text 10, 10, "Use arrow keys to move camera"
   Text 10, 30, "Selected Tool: "+Text$(Tool)


   Sync
Loop

LockPanelTools:
   View Matrix4 ViewMatrix
   r=Inverse Matrix4(ViewMatrix, ViewMatrix)

   Set Vector3 Vector, -10.0, -10.0, 20.0
   Transform Coords Vector3 Vector, Vector, ViewMatrix
   Position Object 1, X Vector3(Vector), Y Vector3(Vector), Z Vector3(Vector)
   Set Vector3 Vector, -10.0, -10.0, 0.0
   Transform Coords Vector3 Vector, Vector, ViewMatrix
   Point Object 1, X Vector3(Vector), Y Vector3(Vector), Z Vector3(Vector)

   Set Vector3 Vector, -6.0, -10.0, 20.0
   Transform Coords Vector3 Vector, Vector, ViewMatrix
   Position Object 2, X Vector3(Vector), Y Vector3(Vector), Z Vector3(Vector)
   Set Vector3 Vector, -6.0, -10.0, 0.0
   Transform Coords Vector3 Vector, Vector, ViewMatrix
   Point Object 2, X Vector3(Vector), Y Vector3(Vector), Z Vector3(Vector)

   Set Vector3 Vector, -2.0, -10.0, 20.0
   Transform Coords Vector3 Vector, Vector, ViewMatrix
   Position Object 3, X Vector3(Vector), Y Vector3(Vector), Z Vector3(Vector)
   Set Vector3 Vector, -2.0, -10.0, 0.0
   Transform Coords Vector3 Vector, Vector, ViewMatrix
   Point Object 3, X Vector3(Vector), Y Vector3(Vector), Z Vector3(Vector)

   Set Vector3 Vector, 2.0, -10.0, 20.0
   Transform Coords Vector3 Vector, Vector, ViewMatrix
   Position Object 4, X Vector3(Vector), Y Vector3(Vector), Z Vector3(Vector)
   Set Vector3 Vector, 2.0, -10.0, 0.0
   Transform Coords Vector3 Vector, Vector, ViewMatrix
   Point Object 4, X Vector3(Vector), Y Vector3(Vector), Z Vector3(Vector)

   Set Vector3 Vector, 6.0, -10.0, 20.0
   Transform Coords Vector3 Vector, Vector, ViewMatrix
   Position Object 5, X Vector3(Vector), Y Vector3(Vector), Z Vector3(Vector)
   Set Vector3 Vector, 6.0, -10.0, 0.0
   Transform Coords Vector3 Vector, Vector, ViewMatrix
   Point Object 5, X Vector3(Vector), Y Vector3(Vector), Z Vector3(Vector)

   Set Vector3 Vector, 10.0, -10.0, 20.0
   Transform Coords Vector3 Vector, Vector, ViewMatrix
   Position Object 6, X Vector3(Vector), Y Vector3(Vector), Z Vector3(Vector)
   Set Vector3 Vector, 10.0, -10.0, 0.0
   Transform Coords Vector3 Vector, Vector, ViewMatrix
   Point Object 6, X Vector3(Vector), Y Vector3(Vector), Z Vector3(Vector)
Return

SelectTool:
   s=Pick Object(MouseX(), MouseY(), 1, 6)
   If s > 0
      Color Object LastSelected, RGB(255,255,255)
      Color Object s, RGB(255,0,0)
      Tool=s
      LastSelected=s
   Endif
Return



Posted: 26th Sep 2003 22:55
Could you probably comment it out, because I'm really interested in how these 3D maths commands work.
Otherwise, good work.