Fix animated physics-only objects. Fixes #2292

This commit is contained in:
Marianne Gagnon 2015-08-25 19:14:10 -04:00
parent 64b4b7a2f2
commit 0cce586c87
2 changed files with 27 additions and 7 deletions

View File

@ -138,7 +138,7 @@ void TrackObjectPresentationSceneNode::move(const core::vector3df& xyz,
// ----------------------------------------------------------------------------
void TrackObjectPresentationSceneNode::setEnable(bool enabled)
{
if (m_node != NULL)
if (m_node != NULL && (!enabled || !m_force_always_hidden))
m_node->setVisible(enabled);
} // setEnable
@ -440,13 +440,30 @@ void TrackObjectPresentationMesh::init(const XMLNode* xml_node,
if (interaction == "physicsonly")
{
m_node = irr_driver->addMesh(m_mesh, m_model_file, parent);
enabled = false;
m_frame_start = 0;
m_frame_end = 0;
std::string type;
xml_node->get("type", &type);
if (type == "animation" || xml_node->hasChildNamed("curve"))
{
// Animated
//m_node = irr_driver->getSceneManager()->addEmptySceneNode();
m_node = irr_driver->addMesh(m_mesh, m_model_file, parent);
enabled = false;
m_force_always_hidden = true;
m_frame_start = 0;
m_frame_end = 0;
}
else
{
// Static
m_node = irr_driver->addMesh(m_mesh, m_model_file, parent);
enabled = false;
m_force_always_hidden = true;
m_frame_start = 0;
m_frame_end = 0;
if (World::getWorld() && World::getWorld()->getTrack() && xml_node)
World::getWorld()->getTrack()->addPhysicsOnlyNode(m_node);
if (World::getWorld() && World::getWorld()->getTrack() && xml_node)
World::getWorld()->getTrack()->addPhysicsOnlyNode(m_node);
}
}
else if (m_is_in_skybox)
{

View File

@ -124,6 +124,8 @@ class TrackObjectPresentationSceneNode : public TrackObjectPresentation
protected:
/** A pointer to the scene node of this object. */
scene::ISceneNode* m_node;
bool m_force_always_hidden;
public:
/** Constructor based on data from xml. */
@ -131,6 +133,7 @@ public:
TrackObjectPresentation(xml_node)
{
m_node = NULL;
m_force_always_hidden = false;
} // TrackObjectPresentationSceneNode
// ------------------------------------------------------------------------
/** Constructor based on a transform. */