diff --git a/src/tracks/track.cpp b/src/tracks/track.cpp index f074a8725..27bd24907 100644 --- a/src/tracks/track.cpp +++ b/src/tracks/track.cpp @@ -2868,7 +2868,10 @@ void Track::copyFromMainProcess() { TrackObject* clone = to->cloneToChild(); if (clone) + { m_track_object_manager->insertObject(clone); + m_track_object_manager->insertDriveableObject(clone); + } } m_track_mesh = new TriangleMesh(/*can_be_transformed*/false); diff --git a/src/tracks/track_object_manager.cpp b/src/tracks/track_object_manager.cpp index dfb0df5f1..d8cb5e0a3 100644 --- a/src/tracks/track_object_manager.cpp +++ b/src/tracks/track_object_manager.cpp @@ -273,6 +273,13 @@ void TrackObjectManager::insertObject(TrackObject* object) m_all_objects.push_back(object); } +// ---------------------------------------------------------------------------- +void TrackObjectManager::insertDriveableObject(TrackObject* object) +{ + if (object && object->isDriveable()) + m_driveable_objects.push_back(object); +} + // ---------------------------------------------------------------------------- /** Removes the object from the scene graph, bullet, and the list of * track objects, and then frees the object. diff --git a/src/tracks/track_object_manager.hpp b/src/tracks/track_object_manager.hpp index 0998078b3..b11b2041d 100644 --- a/src/tracks/track_object_manager.hpp +++ b/src/tracks/track_object_manager.hpp @@ -70,7 +70,7 @@ public: bool interpolate_normal = false) const; void insertObject(TrackObject* object); - + void insertDriveableObject(TrackObject* object); void removeObject(TrackObject* who); void removeDriveableObject(TrackObject* obj) { m_driveable_objects.remove(obj); } TrackObject* getTrackObject(const std::string& libraryInstance, const std::string& name);