Trailer* game::FindHookForTrailer(Ogre::Vector3 TestLoc) { unsigned int C = 0; Ogre::Real small = 2; //The minimum Distance Ogre::Real Distance; Ogre::Vector3 temp; Trailer* Return = NULL; Ogre::Vector3 lol; while(C < mTrailers.size()) { lol = mTrailers.at(C)->GetBody()->getGlobalPosition()+mTrailers.at(C)->GetHooks().PosIt; Distance = lol.distance(TestLoc); Ogre::LogManager::getSingleton().logMessage("Length: "+Ogre::StringConverter::toString(temp.length())); if(Distance < small) { small = Distance; Return = mTrailers.at(C); } C++; } return Return; }