void MumbleVoipModule::Update(f64 frametime) { if (!link_plugin_->IsRunning()) return; time_from_last_update_ms_ += 1000*frametime; if (time_from_last_update_ms_ < UPDATE_TIME_MS_) return; time_from_last_update_ms_ = 0; RexLogic::RexLogicModule *rex_logic_module = dynamic_cast<RexLogic::RexLogicModule *>(framework_->GetModuleManager()->GetModule(Foundation::Module::MT_WorldLogic).lock().get()); if (!rex_logic_module) return; RexLogic::AvatarPtr avatar = rex_logic_module->GetAvatarHandler(); if (avatar) { Scene::EntityPtr entity = avatar->GetUserAvatar(); if (!entity) return; const Foundation::ComponentInterfacePtr &placeable_component = entity->GetComponent("EC_OgrePlaceable"); if (placeable_component) { OgreRenderer::EC_OgrePlaceable *ogre_placeable = checked_static_cast<OgreRenderer::EC_OgrePlaceable *>(placeable_component.get()); Quaternion q = ogre_placeable->GetOrientation(); Vector3df position_vector = ogre_placeable->GetPosition(); Vector3df front_vector = q*Vector3df(1,0,0); Vector3df top_vector(0,0,1); link_plugin_->SetAvatarPosition(position_vector, front_vector, top_vector); } } Scene::EntityPtr camera = rex_logic_module->GetCameraEntity().lock(); if (camera) { const Foundation::ComponentInterfacePtr &placeable_component = camera->GetComponent("EC_OgrePlaceable"); if (placeable_component) { OgreRenderer::EC_OgrePlaceable *ogre_placeable = checked_static_cast<OgreRenderer::EC_OgrePlaceable *>(placeable_component.get()); Quaternion q = ogre_placeable->GetOrientation(); Vector3df position_vector = ogre_placeable->GetPosition(); Vector3df front_vector = q*Vector3df(1,0,0); Vector3df top_vector(0,0,1); link_plugin_->SetCameraPosition(position_vector, front_vector, top_vector); } } link_plugin_->SendData(); }
void Water::RemoveWaterGeometry() { // Adjust that we are removing correct water if( GetActiveWater().expired()) return; // Remove component if ( activeWaterComponent_ != 0) { Scene::EntityPtr entity = activeWaterEntity_.lock(); entity->RemoveComponent(entity->GetComponent(EC_Water::NameStatic())); activeWaterComponent_ = 0; } // Remove entity from scene Scene::ScenePtr active_scene = owner_->GetFramework()->GetDefaultWorldScene(); active_scene->RemoveEntity(activeWaterEntity_.lock()->GetId()); activeWaterEntity_.reset(); emit WaterRemoved(); }