Debug drawer only draws diamonds when I want spheres?
-
- Posts: 20
- Joined: Thu Oct 22, 2009 2:02 pm
Debug drawer only draws diamonds when I want spheres?
I implemented the btIDebugDraw interface and it works. I got lines rendering, and boxes look fine. The problem is that when I add a sphere, the sphere is drawn as a diamond even tghough I emplemented a drawSphere function. Is there a flag somewhere that switches whether to use the default sphere drawing or not?
-
- Posts: 237
- Joined: Tue Jun 29, 2010 10:27 pm
Re: Debug drawer only draws diamonds when I want spheres?
btIDebugDraw declares two drawSphere functions, and my experience in the past (and by looking at Bullet's source code) is that this one:
is never called. The one you should implement/override is
If you look at the default implementation of the above function in btIDebugDraw.h, you'll see where the diamond comes from:
Code: Select all
virtual void drawSphere (const btVector3 &p, btScalar radius, const btVector3 &color);
Code: Select all
virtual void drawSphere(btScalar radius, const btTransform& transform, const btVector3& color);
Code: Select all
virtual void drawSphere(btScalar radius, const btTransform& transform, const btVector3& color)
{
btVector3 start = transform.getOrigin();
const btVector3 xoffs = transform.getBasis() * btVector3(radius,0,0);
const btVector3 yoffs = transform.getBasis() * btVector3(0,radius,0);
const btVector3 zoffs = transform.getBasis() * btVector3(0,0,radius);
// XY
drawLine(start-xoffs, start+yoffs, color);
drawLine(start+yoffs, start+xoffs, color);
drawLine(start+xoffs, start-yoffs, color);
drawLine(start-yoffs, start-xoffs, color);
// XZ
drawLine(start-xoffs, start+zoffs, color);
drawLine(start+zoffs, start+xoffs, color);
drawLine(start+xoffs, start-zoffs, color);
drawLine(start-zoffs, start-xoffs, color);
// YZ
drawLine(start-yoffs, start+zoffs, color);
drawLine(start+zoffs, start+yoffs, color);
drawLine(start+yoffs, start-zoffs, color);
drawLine(start-zoffs, start-yoffs, color);
}
-
- Posts: 20
- Joined: Thu Oct 22, 2009 2:02 pm
Re: Debug drawer only draws diamonds when I want spheres?
Thanks. I'll implement that one too and see if I can get it working.