Fixed mesh objects trying to remove physical bodies when there are none and fixed logic for barrel test to remove the animation

This commit is contained in:
Sachith Hasaranga Seneviratne
2014-08-02 09:15:48 +05:30
parent 30bd018738
commit 8eb5fc0d94
2 changed files with 4 additions and 2 deletions

View File

@@ -4,13 +4,13 @@ void onKartObjectCollision()
int kart_id = getCollidingKart1();
Vec3 location = getKartLocation(kart_id);
createExplosion(location);
disableAnimation("stklib_fitchBarreltest_a_main");
}
else {
displayMessage("Woot! You hit item of ID: " + getCollidingID());
disableAnimation(getCollidingID());
Vec3 explosion_loc = Vec3(79.53,0.07,97.13);
createExplosion(explosion_loc);
disableAnimation("stklib_fitchBarreltest_a_main.b3d");
}
}

View File

@@ -68,6 +68,7 @@ void TrackObjectManager::add(const XMLNode &xml_node, scene::ISceneNode* parent,
*/
void TrackObjectManager::init()
{
TrackObject* curr;
for_in (curr, m_all_objects)
{
@@ -98,7 +99,8 @@ void TrackObjectManager::disable(std::string name)
curr->setEnable(false);
if (curr->getType() == "mesh")
{
curr->getPhysicalObject()->removeBody();
if (curr->getPhysicalObject()!=NULL)
curr->getPhysicalObject()->removeBody();
}
}
}