diff --git a/ogre/src/OgreWireBox.cc b/ogre/src/OgreWireBox.cc index e44c064ba..c071af58d 100644 --- a/ogre/src/OgreWireBox.cc +++ b/ogre/src/OgreWireBox.cc @@ -84,6 +84,9 @@ void OgreWireBox::Create() this->scene->OgreSceneManager()->createManualObject(this->name); } + if (this->box == math::AxisAlignedBox()) + return; + this->dataPtr->manualObject->clear(); this->dataPtr->manualObject->setCastShadows(false); @@ -169,6 +172,10 @@ void OgreWireBox::SetMaterial(MaterialPtr _material, bool _unique) ////////////////////////////////////////////////// void OgreWireBox::SetMaterialImpl(OgreMaterialPtr _material) { + if (!this->dataPtr->manualObject || + this->dataPtr->manualObject->getNumSections() == 0u) + return; + std::string materialName = _material->Name(); Ogre::MaterialPtr ogreMaterial = _material->Material(); this->dataPtr->manualObject->setMaterialName(0, materialName);