Fix crashes
This commit is contained in:
@@ -117,7 +117,10 @@ void PartInstance::setSurface(int face, Enum::SurfaceType::Value surface)
|
||||
|
||||
void PartInstance::setParent(Instance* prnt)
|
||||
{
|
||||
g_dataModel->getEngine()->deleteBody(this);
|
||||
if(this->physBody != NULL)
|
||||
{
|
||||
g_dataModel->getEngine()->deleteBody(this);
|
||||
}
|
||||
Instance * cparent = getParent();
|
||||
while(cparent != NULL)
|
||||
{
|
||||
@@ -202,8 +205,11 @@ void PartInstance::setSize(Vector3 newSize)
|
||||
|
||||
size = Vector3(sizex, sizey, sizez);
|
||||
|
||||
g_dataModel->getEngine()->deleteBody(this);
|
||||
g_dataModel->getEngine()->createBody(this);
|
||||
if(this->physBody != NULL)
|
||||
{
|
||||
g_dataModel->getEngine()->deleteBody(this);
|
||||
g_dataModel->getEngine()->createBody(this);
|
||||
}
|
||||
}
|
||||
Vector3 PartInstance::getSize()
|
||||
{
|
||||
@@ -224,8 +230,11 @@ void PartInstance::setShape(Enum::Shape::Value shape)
|
||||
this->shape = shape;
|
||||
this->setSize(this->getSize());
|
||||
}
|
||||
g_dataModel->getEngine()->deleteBody(this);
|
||||
g_dataModel->getEngine()->createBody(this);
|
||||
if(this->physBody != NULL)
|
||||
{
|
||||
g_dataModel->getEngine()->deleteBody(this);
|
||||
g_dataModel->getEngine()->createBody(this);
|
||||
}
|
||||
changed = true;
|
||||
}
|
||||
|
||||
@@ -238,8 +247,11 @@ void PartInstance::setPosition(Vector3 pos)
|
||||
void PartInstance::setAnchored(bool anchored)
|
||||
{
|
||||
this->anchored = anchored;
|
||||
g_dataModel->getEngine()->deleteBody(this);
|
||||
g_dataModel->getEngine()->createBody(this);
|
||||
if(this->physBody != NULL)
|
||||
{
|
||||
g_dataModel->getEngine()->deleteBody(this);
|
||||
g_dataModel->getEngine()->createBody(this);
|
||||
}
|
||||
}
|
||||
|
||||
bool PartInstance::isAnchored()
|
||||
|
||||
Reference in New Issue
Block a user