AUVec3f GetSpawnPosition( EGameObject type ) { float width, height; PerModuleInterface::g_pSystemTable->pGame->GetWindowSize( width, height ); float edgeMargin = 0.05f; // Spawn WBC in bottom quarter of screen, RBC in middle quarter, and Virus and Infected Cell // in the top quarter float min = height * edgeMargin; // from bottom of screen float max = height * (1 - edgeMargin); // from bottom of screen if (type == EGO_WBC) { max = height * 0.25f; } else if (type == EGO_RBC) { min = height * 0.375f; max = height * 0.625f; } else { min = height * 0.75f; } AUVec3f position; position.SetX( rand() * 1.0f / RAND_MAX * width * (1.0f - edgeMargin * 2) - width * (0.5f - edgeMargin) ); position.SetY( 0.0f ); position.SetZ( rand() * 1.0f / RAND_MAX * (max - min) + min - height * 0.5f); return position; }