0

I've been using the Bullet physics engine with OpenGL to visualise my simulations. I currently have a very simple simulation of a cube that has an initial horizontal and forward velocity that falls down from the sky and collides with the walls of a room that are all slanted at 45 degrees, with the bottom of the wall meeting the floor.

I use getOpenGLMatrix to get the orientation, position, etc. of the cube and map it to OpenGL by making that matrix the Model matrix. However, when I run it and visualise the simulation the cube behaves as expected (rolls down the wall), but it does not "touch" the rendered OpenGL wall (I say touch but of course mean the rendered cube does not appear to come near the rendered wall).

My Bullet cube is 2x2x2 (specified by btBoxShape(btVector3(1.0f,1.0f,1.0f))). My OpenGL cube is also 2x2x2, with the origin at 0 and corners 1.0 away in each direction.

The only thing I can think of is that the coordinates in Bullet physics do not map directly to the coordinates of OpenGL (for example, a cube edge of length 1 in Bullet is X pixels, but a cube edge of length 1 in OpenGL is Y pixels). Is this the case? If not, can you think why I might have this issue (obviously I don't expect you to magically know the answer, just wondering if there are any known issues like this).

Thanks

infraed
  • 23
  • 1
  • 4
  • "*Is this the case?*" That's up to you. The scale of OpenGL and the scale of Bullet Physics are defined by whatever you want them to be. – Nicol Bolas Dec 05 '16 at 01:20
  • @NicolBolas Okay, then in that case how can I make sure the scales match? Just trial and error until they are the same? – infraed Dec 05 '16 at 10:17
  • You can use de bullet debug drawing stuff to visualize the actual physics object, you might be able to find what is wrong with your opengl transforms / objects – cmourglia Dec 06 '16 at 15:38

0 Answers0