I'm using the Bullet physics library in my program and am currently trying to implement picking. The way the world is currently set up, there is a terrain with a box on top of it. Whenever I click on the box, my program only registers that the terrain has been clicked and doesn't recognize that the box has been clicked.
> my program only registers that the terrain has been clicked and doesn't recognize that the box has been clicked.
You mean that the terrain is the only object to collide (RayCallback.m_collisionObjects.size() == 1)
or that it is the "Closest"
¿why RayStart.z = -1?
¿why RayDirection.norm = 1000?
¿why in 'rayTest()' you are repeating the information contained in 'RayCallback'?
> Maybe but couldn't adding another render pass slow things down when rendering a large scene?
But the rendering for the colour map is simpler. No textures, no blending, no lighting, and you could reduce a lot the level of detail.
You may draw the testing ray in order to check that it is calculated properly.
Then, make sure that the 'rayTest()' function is actually passing through all the objects of interest.