TUTORIAL 15:   This tutorial explains how To Use NemoX Camera2 class interface. This class provide several routines to parameter camera : rotation on 3 separate axes, 2 modes (FPS and 6DOF),use othographic or perpective projection.Quaternion rotation is supported.
             
 

 

----TUTORIAL 15---

Using Free 6DOF camera

 

You will Need The NemoX engine Get it Here

download the Visual Basic Source code here

 

Summary

 

1. Preparing 6 Degree Of freeDom camera

2. Handle camera rotation with mouse

 

 

1. Preparing 6 Degree Of FreeDom camera

Before using NemoX camera class, an object must be declared and allocated for it.
 

'New in NemoX 1.74
'this will handle camera moves
'the new camera class support Mouse rotation
' and Freelook (6DOF style)
'===============NEW CAMERA SYSTEM=======
'
'
'============================
Dim KAMERA As cNemo_Camera2

 .

Set KAMERA = New cNemo_Camera2  '.......MEMORY ALLOCATION...

 

'===================INITIALIZATION============'

'set some parameters 'near far  FOVangle,Aspect
    KAMERA.Set_ViewFrustum 5, 16000, 3.14 / 4, 1.01

'Set Projection type we use here Perpective Left Hand
KAMERA.Set_CameraProjectionType PT_PERSPECTIVE_LH


    'set our camera position
    KAMERA.Set_Position Vector(0, 50, -50)    'Starting Position
  
    'we specify 6 degrees of freedom camera style
    'note: the default style is First person Shooter
    KAMERA.Set_CameraStyle FREE_6DOF
   

  
 

 

2. Handle camera rotation with mouse

 

'just move Forward if player Press UP ARROW KEY

    If KEY.Get_KeyBoardKeyPressed(NEMO_KEY_UP) Then _
       KAMERA.Move_Forward 1 * MoveSpeed

    'fast Forward
    If KEY.Get_KeyBoardKeyPressed(NEMO_KEY_RCONTROL) Then _
       KAMERA.Move_Forward 4 * MoveSpeed

    'just move BackWard if player Press DOWN ARROW KEY
    If KEY.Get_KeyBoardKeyPressed(NEMO_KEY_DOWN) Then _
       KAMERA.Move_Backward 1 * MoveSpeed
       
       
    '============NEW CODE============'
    'we use mouse arcball system
    'to manage camera rotation
    '
    '
    'KAMERA.RotateByMouse mousepseed,invertMousePitching,recenterMouse 
    '
    
    'we use default value and we do not recenter mouse after each
    'rotation and mouse moves
    '====!!! when recenter the mouse position
    '====!!! there is a lil bug that will be fixed soon==
    KAMERA.RotateByMouse 0.001, False, False
    
    
    'do not forget to actualize camera state
    'very important for object frustum visibility
    'testing
    
    KAMERA.Update 'this actualize view matrix and frustum planes
    

 

Here is a screenshot for our tutorial project

download the Visual Basic Source code here

See you in the next Tutorial.....sincerly Polaris..Don't forget Any Bugs detect

    The Next: Tutorial 16 :Camera Bspline Path Folowing

 The Previous: Tutorial 14 :Adding Great Particle FX

 

Tutorial Written on April, 28 th 2003 by Polaris: johna_pop@yahoo.fr