Remove physics only invisible objects after joining

This commit is contained in:
Benau 2019-03-03 01:54:43 +08:00
parent 1193c588b4
commit 3cee39aff7
2 changed files with 11 additions and 0 deletions

View File

@ -2148,7 +2148,15 @@ void Track::loadTrackModel(bool reverse_track, unsigned int mode_id)
for (auto* to : m_track_object_manager->getObjects().m_contents_vector)
{
if (to->joinToMainTrack())
{
m_track_object_manager->removeDriveableObject(to);
TrackObjectPresentationSceneNode* ts =
to->getPresentation<TrackObjectPresentationSceneNode>();
// physicial only node is always hidden, remove it from stk after
// joining to track mesh
if (ts && ts->isAlwaysHidden())
m_track_object_manager->removeObject(to);
}
}
createPhysicsModel(main_track_count);

View File

@ -149,6 +149,7 @@ public:
TrackObjectPresentation(xyz, hpr, scale)
{
m_node = node;
m_force_always_hidden = false;
} // TrackObjectPresentationSceneNode
// ------------------------------------------------------------------------
@ -168,6 +169,8 @@ public:
// ------------------------------------------------------------------------
/** Returns a pointer to the scene node, const version. */
const scene::ISceneNode* getNode() const { return m_node; }
// ------------------------------------------------------------------------
bool isAlwaysHidden() const { return m_force_always_hidden; }
}; // class TrackObjectPresentationSceneNode
// ============================================================================