/** Initialises all track objects.
 */
void TrackObjectManager::init()
{
    int moveable_objects = 0;
    bool warned = false;
    for (unsigned i = 0; i < m_all_objects.m_contents_vector.size(); i++)
    {
        TrackObject* curr = m_all_objects.m_contents_vector[i];
        curr->onWorldReady();

        if (moveable_objects > stk_config->m_max_moveable_objects)
        {
            if (!warned)
            {
                Log::warn("TrackObjectManager",
                    "Too many moveable objects (>%d) in networking.",
                    stk_config->m_max_moveable_objects);
                warned = true;
            }
            curr->setInitiallyVisible(false);
            curr->setEnabled(false);
            continue;
        }

        // onWorldReady will hide some track objects using scripting
        if (NetworkConfig::get()->isNetworking() &&
            curr->isEnabled() && curr->getPhysicalObject() &&
            curr->getPhysicalObject()->isDynamic())
        {
            curr->getPhysicalObject()->getBody()
                ->setActivationState(DISABLE_DEACTIVATION);
            curr->getPhysicalObject()->addForRewind();
            moveable_objects++;
        }
    }
}   // init
/** Initialises all track objects.
 */
void TrackObjectManager::reset()
{
    TrackObject* curr;
    for_in (curr, m_all_objects)
    {
        curr->reset();
        if (!curr->isEnabled())
        {
            //PhysicalObjects may need to be added
            if (curr->getType() == "mesh")
            {
                if (curr->getPhysicalObject() != NULL)
                    curr->getPhysicalObject()->addBody();
            }
        }
        curr->setEnable(true);
    }