I am having trouble getting the debug viewer to play nice. I have done the following :
Code: Select all
class CBulletDebugDraw : public btIDebugDraw
{
virtual void drawLine(const btVector3& from,const btVector3& to,const btVector3& color);
virtual void drawLine(const btVector3& from,const btVector3& to, const btVector3& fromColor, const btVector3& toColor);
virtual void drawTriangle(const btVector3& v0,const btVector3& v1,const btVector3& v2,const btVector3& color, btScalar alpha ) { }
virtual void drawContactPoint(const btVector3& PointOnB,const btVector3& normalOnB,btScalar distance,int lifeTime,const btVector3& color) {};
virtual void reportErrorWarning(const char* warningString);
virtual void draw3dText(const btVector3& location,const char* textString) { };
virtual void setDebugMode(int debugMode) { };
virtual int getDebugMode() const ;
};
...
void CBulletDebugDraw::drawLine(const btVector3& from,const btVector3& to,const btVector3& color)
{
Vec3d vFrom(from.m_floats[0],from.m_floats[1],from.m_floats[2]);
Vec3d vTo(to.m_floats[0],to.m_floats[1],to.m_floats[2]);
g_Renderer.AddDebugLine(vFrom,vTo);
}
void CBulletDebugDraw::drawLine(const btVector3& from,const btVector3& to, const btVector3& fromColor, const btVector3& toColor)
{
drawLine(from,to,fromColor);
}
int CBulletDebugDraw::getDebugMode() const
{
return DBG_DrawWireframe;
}
void CBulletDebugDraw::reportErrorWarning( const char* warningString )
{
... logging code ...
}
add 3 rigid bodies with different kinds of shapes.
However, this causes an access violation in btCollisionWorld.cpp in the method debugDrawWorld(), line 1444 (not too sure how reliable that is).
I know this isn't too much to go on, but does anyone have an idea what could be causing this? Is there anything obvious I am missing, or something
I do not know regarding the debug viewer?
When I do not add the rigid bodies to the world the program runs fine. The physics also seems to be working fine when I do not use the debug viewer.
Any help would be much appreciated!
Thanks