Rendering Collision Shapes

Post Reply
hmz
Posts: 1
Joined: Sat May 18, 2013 12:12 am

Rendering Collision Shapes

Post by hmz »

I have a mesh that I am trying to approximate using a btCapsuleShape. To do so, I set the radius, height, origin and quaternion transform that describes its orientation. I would like to overlay the collision shape on top of my mesh to see how well the collision shape is approximating it. How do I get the coordinates of the collision shape to plot? Even if it is a btBoxShape, how would you do it?
laadams85
Posts: 18
Joined: Wed May 22, 2013 1:45 pm

Re: Rendering Collision Shapes

Post by laadams85 »

It is best to use Motion States for rendering, but if you just want to know the location and orientation of the collision shape you can us the getWorldTransform() method from the collisionObject. This gives you the basis (rotation matrix), and the origin. Then the actual size of the shape is dependent on the shape type, but for a box you would use the getHalfExtentsWithoutMargin() method and for the capsule use the getRadius() method and the getHalfHeight() method.
wanmer
Posts: 5
Joined: Sun Mar 31, 2013 5:08 pm

Re: Rendering Collision Shapes

Post by wanmer »

You could use the graphical debugger. Override btIDebugDraw, implement the drawLine method using OpenGL or your rendering engine and Bullet will take care of everything else and draw the collision shape on top of whatever is on screen.

Look at page 16 of the user manual and here: http://bulletphysics.org/Bullet/BulletF ... gDraw.html.
Post Reply