Rendering Collision Shapes
Rendering Collision Shapes
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?
Re: Rendering Collision Shapes
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.
Re: Rendering Collision Shapes
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.
Look at page 16 of the user manual and here: http://bulletphysics.org/Bullet/BulletF ... gDraw.html.