void SceneNode::detachObject( MovableObject & object ) { auto it = std::find_if( m_objects.begin(), m_objects.end(), [&object]( std::reference_wrapper< MovableObject > obj ) { return obj.get().getName() == object.getName(); } ); if ( it != m_objects.end() ) { m_objects.erase( it ); object.attachTo( nullptr ); } }
void SceneNode::attachObject( MovableObject & object ) { object.detach(); m_objects.push_back( object ); object.attachTo( shared_from_this() ); }