how can i use btIDebugDraw in my application?

zanyzany
Posts: 1
Joined: Wed Feb 18, 2009 6:21 am

how can i use btIDebugDraw in my application?

Post by zanyzany »

hi, everyone. i'm using Bullet.2.73 version based Direct X in my application.

First, sorry for my english level.
my english level is very low so may be you can't understand what i say.

i want use only Collision Detection part in Bullet.
so i saw CollisionInterfaceDemo project. and i try same method my app.

create Box like this.

Code: Select all

btCollisionObject * obj = new btCollisionObject();
btCollisionWorld * world = new btCollisionWorld(........);  
btMatrix3X3 basisA;
basisA.setIdentity();

btBoxShape * box = new btBoxShape( btVector3( 0.0f, 0.0f, 0.0f ) );
obj->getWorldTransform().setBasis(basisA);
obj->setCollisionShape(box);
create Triangle..

Code: Select all

m_ indexVertex = btTriangleIndexVertexArray( totalverts, gIndices, indexstride, totalverts, (btScalar*) &gvertices[0].x(), vertstride);
trimeshShape = new btBvhTriangleMeshShape( m_ indexVertex, true, aabbmin, aabbmax );
and then, i was run program.. but i have some problem..

triangle is not correct position. so i get contact result wrong position.

search internet to solve problem.. but i can't find it..
and i hope draw triangle using btIDebugDraw.

so i inherite btIDebugDraw and implement DrawLine() like this...

class DxDebugDraw : public btIDebugDraw
{
virtual void DrawLine();
}

and.. i set debug Mode

Code: Select all

DxDebugDraw debug_draw;
debug_draw.setDebugMode( debug_draw.getDebugMode() | btIDebugDraw::DBG_DrawWireframe );
and set DebugDrawer

Code: Select all

world.getdispatchInfo().m_debugDraw = debug_draw;

but it's not work.. and i can't see any drawing.

plz. anyone help me.

what i miss creating shape or using btIDebugDraw ?
when call DrawLine() in btIDebugDraw at Bullet library ?

i was using only Collision Detect part.
so i find some reference paper on the Internet.
have any reference paper you got it?
mickey
Posts: 107
Joined: Fri Sep 19, 2008 6:08 pm

Re: how can i use btIDebugDraw in my application?

Post by mickey »

Hi

I didn't derived from btIDebugDraw per se but I created my own DirectX shape drawer similar to the sample sdk OpenGl drawer, you can find at my site.

Hope that helps.