//----------------------------------------------------------------------------// // Snippet-3-1 - BEGIN // //----------------------------------------------------------------------------// #include //----------------------------------------------------------------------------// // Snippet-3-1 - END // //----------------------------------------------------------------------------// //----------------------------------------------------------------------------// // Snippet-3-2 - BEGIN // //----------------------------------------------------------------------------// void initCoreComponentCallback(CoreComponents comp) { // register factory for avatara avatars if (comp == USERDATABASE) { WorldDatabase::registerAvatarFactory (new AvataraAvatarFactory()); } // else if } // initCoreComponentCallback //----------------------------------------------------------------------------// // Snippet-3-2 - END // //----------------------------------------------------------------------------// //----------------------------------------------------------------------------// // Snippet-3-3 - BEGIN // //----------------------------------------------------------------------------// AvatarInterface* avatar; gmtl::Vec3f COORDINATE_SYSTEM_CENTER; //----------------------------------------------------------------------------// // Snippet-3-3 - END // //----------------------------------------------------------------------------// //----------------------------------------------------------------------------// // Snippet-3-4 - BEGIN // //----------------------------------------------------------------------------// avatar = NULL; COORDINATE_SYSTEM_CENTER = gmtl::Vec3f(5, 1, 5); //----------------------------------------------------------------------------// // Snippet-3-4 - END // //----------------------------------------------------------------------------// //----------------------------------------------------------------------------// // Snippet-3-5 - BEGIN // //----------------------------------------------------------------------------// avatar = localUser->getAvatar(); if (!avatar) { printd(ERROR, "GoingImmersive::initialize(): unable to obtain avatar! Check UserDatabase configuration!\n"); return false; } // if //----------------------------------------------------------------------------// // Snippet-3-5 - END // //----------------------------------------------------------------------------// //----------------------------------------------------------------------------// // Snippet-3-6 - BEGIN // //----------------------------------------------------------------------------// void updateAvatar() { TransformationData trackedUserTrans = localUser->getTrackedUserTransformation(); trackedUserTrans.position += COORDINATE_SYSTEM_CENTER; avatar->setTransformation(trackedUserTrans); } // updateAvatar //----------------------------------------------------------------------------// // Snippet-3-6 - END // //----------------------------------------------------------------------------// //----------------------------------------------------------------------------// // Snippet-3-7 - BEGIN // //----------------------------------------------------------------------------// updateAvatar(); //----------------------------------------------------------------------------// // Snippet-3-7 - END // //----------------------------------------------------------------------------//