This time my question is regarding ISceneCollisionManager::getSceneNodeFromCameraBB(), and selecting nodes. The goal was, in this part of my project, to be able to select an arbitrary node in the scene and have it become wireframe; the selection process is triggered by pointing at a node and right-clicking on the mouse. Nodes are deselected simply by pointing anywhere and clicking (or at another node to deselect and select at the same time.)
The issue is that even when the right mouse button is pressed and the observer is not aiming at a node, getSceneNodeFromCameraBB() seems to not return null. I say this because pointedNode, the variable I have getSceneNodeFromCameraBB() return into, comes up true when checked to ensure it is not null, (in line 9) causing a segmentation fault in line ten where it is accessed.
Code: Select all
if (receiver->rightMouseButtonPressed())
{
scene::ISceneNode* pointedNode = smgr->getSceneCollisionManager()->getSceneNodeFromCameraBB(camera, -1);
if (selected != 0)
((scene::IMeshSceneNode*)selected)->getMesh()->setMaterialFlag(video::E_MATERIAL_FLAG::EMF_WIREFRAME, false);
selected = pointedNode;
if (selected != 0)
((scene::IMeshSceneNode*)selected)->getMesh()->setMaterialFlag(video::E_MATERIAL_FLAG::EMF_WIREFRAME, true);
}
-Will