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:
@@ -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");
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -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();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user