Bugfix for animations with physics represenation.

git-svn-id: svn+ssh://svn.code.sf.net/p/supertuxkart/code/main/trunk@4420 178a84e3-b1eb-0310-8ba1-8eac791a3b58
This commit is contained in:
hikerstk 2010-01-10 12:10:39 +00:00
parent 0c8465a913
commit 5967f75b20

View File

@ -95,7 +95,7 @@ void ThreeDAnimation::createPhysicsBody(const std::string &shape)
m_motion_state = new KartMotionState(trans);
btRigidBody::btRigidBodyConstructionInfo info(0, m_motion_state,
m_collision_shape);
m_body = new btRigidBody(info);
m_user_pointer.set(this);
m_body->setUserPointer(&m_user_pointer);
@ -108,10 +108,13 @@ void ThreeDAnimation::createPhysicsBody(const std::string &shape)
/** Destructor. */
ThreeDAnimation::~ThreeDAnimation()
{
RaceManager::getWorld()->getPhysics()->removeBody(m_body);
delete m_body;
delete m_motion_state;
delete m_collision_shape;
if(m_body)
{
RaceManager::getWorld()->getPhysics()->removeBody(m_body);
delete m_body;
delete m_motion_state;
delete m_collision_shape;
}
} // ~ThreeDAnimation
// ----------------------------------------------------------------------------