How to Switch a vgObserver to use a vgMotion Model

 

Vega Code Example

 

 

 

 

 

 
 

This example provides 1 functions which  illustrates :

  • How to switch vgObserver to a vgMotion Model
  • How to get a pointer to a vgObserver
  • How to get a pointer to a vgPlayer
  • How to get a pointer to a vgMotion model
  • How to disable a vgNavigator
  • How to enable a vgObserver
  • How to enable a vgMotion model
  • How to set the tethered state of vgObserver to dynamic
  • How to associate a vgObserver with a vgMotion model  

 

 
   
 

 

 
 
 
    
 

#include "vg.h"          // Required for the standard Vega classes

 

void

switchObserver2MotionModel( const int obsIdx, const int motIdx ){

// ##########################################################

// # Local Function

// #

// # This functions show how to change a vgObserver to  use

// # a vgMotion Model

// #

// #

// ##########################################################

 

    //

    // We need a pointer to the observer

    //

    vgObserver *obs = vgGetObserv(obsIdx);

 

    //

    // Remove the Navigator association with the Observer

    //

    vgObservNav(  obs, NULL );

 

    //

    // Remove the Player association with the Observer

    //

    vgObservPlyr( obs, NULL );

   

    //

    // Retrieve the motion model and enable it

    //

    vgMotion *mot = vgGetMot(motIdx);

    

    vgProp( mot, VGCOMMON_ENABLED, VG_ON );

    

    vgUpdate( mot );

 

    //

    // Associate the motion model with the observer

    //

    vgObservMot(  obs, mot );       

 

    //

    // The Observer needs to be relative to the origin

    //

    vgProp( obs, VGOBS_TETHERCOORD, VGOBS_TABSOLUTE);

    

    //

    // The Observer now needs to be Dynamic Tethered state

    //

    vgProp( obs, VGOBS_TETHERSTATE, VGOBS_DYNAMIC  );

    

    //

    // Finally enable the Observer

    //

    vgProp( obs, VGCOMMON_ENABLED,  VG_ON  );  

 

 

} // switchObserver2MotionModel

 

 

   

 
    
 

 

 

© Copyright 2004 Gordon Tomlinson  All Rights Reserved.

All logos, trademarks and copyrights in this site are property of their respective owner.