Ghost::Ghost(Position pos) { ghost_velocity = GHOST_VELOCITY; WorldManager &world_manager = WorldManager::getInstance(); setPosition(pos); setType("Ghost"); setSolidness(SOFT); //Ghosts can move through anything setAltitude(MAX_ALTITUDE); //TODO: This takes too long to find, is there a more efficient way? /* ObjectList objects = world_manager.getAllObjects(); ObjectListIterator iterator = objects.createIterator(); bool found = false; while(!iterator.isDone() && !found){ if (iterator.currentObject()->getType() == "Hero"){ hero_pos = iterator.currentObject()->getPosition(); found = true; } } */ // if (!found){ Position h_pos(world_manager.getBoundary().getHorizontal() / 2, world_manager.getBoundary().getVertical() / 2); hero_pos = h_pos; // } LogManager &lm = LogManager::getInstance(); ResourceManager &rm = ResourceManager::getInstance(); Sprite *p_temp_sprite; p_temp_sprite = rm.getSprite("ghost"); if (!p_temp_sprite) { lm.writeLog("Ghost::Ghost(): Warning! Sprite '%s' not found", "ghost"); } else { setSprite(p_temp_sprite); setSpriteSlowdown(15); } max_speed_cooldown = MAX_SPEED_COOLDOWN; speed_cooldown = max_speed_cooldown; registerInterest(HERO_MOVE_EVENT); registerInterest(STEP_EVENT); registerInterest(COLLISION_EVENT); registerInterest(LEVEL_UP_EVENT); }
FGColumnVector3 FGRotor::rotor::body_moments(FGColumnVector3 F_h, double a_ic, double b_ic) { FGColumnVector3 M_s, M_hub, M_h; FGColumnVector3 h_pos(RelDistance_xhub, 0.0, RelHeight_zhub); // vermutlich ein biege moment, bzw.widerstands moment ~ d^3 double M_w_tilde = 0.0 ; double mf = 0.0 ; M_w_tilde = BladeMassMoment; // cyclic flapping relative to shaft axes /SH79/ eqn(43) a1s = a_1*cos(beta_orient) + b_1*sin(beta_orient) - b_ic; b1s = b_1*cos(beta_orient) - a_1*sin(beta_orient) + a_ic; // mind this: no HingeOffset, no additional pitch/roll moments mf = 0.5 * (HingeOffset+HingeOffset_hover) * BladeNum * Omega*Omega * M_w_tilde; M_s(eL) = mf*b1s; M_s(eM) = mf*a1s; M_s(eN) = Torque; if (flags & eRotCW) { M_s(eN) = -M_s(eN); } if (flags & eCoaxial) { M_s(eN) = 0.0; } M_hub = ShaftToBody * M_s; M_h = M_hub + (h_pos * F_h); return M_h; }