Added asserts to bullet calls to catch NANs early on.
git-svn-id: svn+ssh://svn.code.sf.net/p/supertuxkart/code/main/trunk@8781 178a84e3-b1eb-0310-8ba1-8eac791a3b58
This commit is contained in:
@@ -21,6 +21,11 @@ subject to the following restrictions:
|
||||
#include "BulletCollision/BroadphaseCollision/btBroadphaseProxy.h"
|
||||
#include "BulletCollision/CollisionDispatch/btCollisionObject.h"
|
||||
|
||||
#if defined(WIN32) && !defined(__CYGWIN__)
|
||||
# define isnan _isnan
|
||||
#endif
|
||||
#include <math.h>
|
||||
|
||||
class btCollisionShape;
|
||||
class btMotionState;
|
||||
class btTypedConstraint;
|
||||
@@ -253,6 +258,9 @@ public:
|
||||
}
|
||||
void setLinearFactor(const btVector3& linearFactor)
|
||||
{
|
||||
btAssert(!isnan(linearFactor.getX()));
|
||||
btAssert(!isnan(linearFactor.getY()));
|
||||
btAssert(!isnan(linearFactor.getZ()));
|
||||
m_linearFactor = linearFactor;
|
||||
m_invMass = m_linearFactor*m_inverseMass;
|
||||
}
|
||||
@@ -355,11 +363,17 @@ public:
|
||||
|
||||
inline void setLinearVelocity(const btVector3& lin_vel)
|
||||
{
|
||||
btAssert(!isnan(lin_vel.getX()));
|
||||
btAssert(!isnan(lin_vel.getY()));
|
||||
btAssert(!isnan(lin_vel.getZ()));
|
||||
m_linearVelocity = lin_vel;
|
||||
}
|
||||
|
||||
inline void setAngularVelocity(const btVector3& ang_vel)
|
||||
{
|
||||
btAssert(!isnan(ang_vel.getX()));
|
||||
btAssert(!isnan(ang_vel.getY()));
|
||||
btAssert(!isnan(ang_vel.getZ()));
|
||||
m_angularVelocity = ang_vel;
|
||||
}
|
||||
|
||||
|
||||
@@ -20,6 +20,12 @@
|
||||
#ifndef HEADER_KART_MOTION_STATE_HPP
|
||||
#define HEADER_KART_MOTION_STATE_HPP
|
||||
|
||||
#if defined(WIN32) && !defined(__CYGWIN__)
|
||||
# define isnan _isnan
|
||||
#else
|
||||
# include <math.h>
|
||||
#endif
|
||||
|
||||
#include "LinearMath/btMotionState.h"
|
||||
|
||||
/** This is a very simple motion state implementation for bullet, which does
|
||||
@@ -61,6 +67,13 @@ public:
|
||||
*/
|
||||
virtual void setWorldTransform(const btTransform &new_trans)
|
||||
{
|
||||
assert(!isnan(new_trans.getOrigin().getX()));
|
||||
assert(!isnan(new_trans.getOrigin().getY()));
|
||||
assert(!isnan(new_trans.getOrigin().getZ()));
|
||||
assert(!isnan(new_trans.getRotation().getX()));
|
||||
assert(!isnan(new_trans.getRotation().getY()));
|
||||
assert(!isnan(new_trans.getRotation().getZ()));
|
||||
assert(!isnan(new_trans.getRotation().getW()));
|
||||
m_center_of_mass = new_trans;
|
||||
} // setWorldTransform
|
||||
|
||||
|
||||
Reference in New Issue
Block a user