Bug with getSceneNodeFromScreenCoordinatesBB does not fixed?
Why? This bug fixed in SVN.
Irrlicht 1.2 & getSceneNodeFromScreenCoordinatesBB
I am not remember revision of my CSceneCollisionManager.cpp.
Му CSceneCollisionManager.cpp: http://www.webpolit.com/irr/CSceneCollisionManager.cpp
My code works with this file but not works with IrrLicht 1.2
Му CSceneCollisionManager.cpp: http://www.webpolit.com/irr/CSceneCollisionManager.cpp
My code works with this file but not works with IrrLicht 1.2
Code: Select all
position2di pos = device->getCursorControl()->getPosition();
hoveredSceneNode = smgr->getSceneCollisionManager()->getSceneNodeFromScreenCoordinatesBB(pos);
Have you tried to use the debugger to figure out why? Five seconds and a debugger or a printf would tell you if something was selected, but it wasn't what you wanted or that nothing was selected at all. A few minutes and a few breakpoints would tell you how many nodes actually were intersected by the line, and inspection would tell you what they are...
I'm willing to bet that the problem is some other node is getting selected, most likely the camera. Often, the camera will get selected when you don't use a mask. I suggest you try setting the camera id to 0 and pass a mask to getSceneNodeFromScreenCoordinatesBB to avoid picking the camera. You can pass 0xffffffff to select everything that has a non-zero id.
Travis
I'm willing to bet that the problem is some other node is getting selected, most likely the camera. Often, the camera will get selected when you don't use a mask. I suggest you try setting the camera id to 0 and pass a mask to getSceneNodeFromScreenCoordinatesBB to avoid picking the camera. You can pass 0xffffffff to select everything that has a non-zero id.
Travis
vitek wrote:Have you tried to use the debugger to figure out why? Five seconds and a debugger or a printf would tell you if something was selected, but it wasn't what you wanted or that nothing was selected at all. A few minutes and a few breakpoints would tell you how many nodes actually were intersected by the line, and inspection would tell you what they are...
I got also that problem. But it is not the Camera that get selected. It is the SceneNode behind my Nodes. In fact it is the Table, where i put more than 100 Pieces on the Top. It worked with Irrlicht 1.1. but not exactly enough. I changed the ColissionManager with that Patch : http://irrlicht.sourceforge.net/phpBB2/ ... hp?t=15549. And now it works very accurate. Then i switched to Irrlicht 1.2 (without patch !) and the selection is completly wrong. I click on a piece and the table or the complete room is selected. But not that piece. So i go ahead and make the same patch as for Irrlicht 1.1 again. And now it works.....
I hope this helps.....
Mike
Actually, I don't care if it is simple or not. Just zip up and send your entire program if you don't mind.
Also, the reason my patch didn't use transformBoxEx() is that the box returned by that method is larger than the original box. This can cause picking problems when selecting some nodes. You can see the difference in the following image...
The red box is the one from transformBoxEx(). The blue one is from node->getTransformedBoundingBox(), and the green one is the object space bounding box. I think you'll agree that, for purposes of selecting, the green box is the best.
Also, the reason my patch didn't use transformBoxEx() is that the box returned by that method is larger than the original box. This can cause picking problems when selecting some nodes. You can see the difference in the following image...
The red box is the one from transformBoxEx(). The blue one is from node->getTransformedBoundingBox(), and the green one is the object space bounding box. I think you'll agree that, for purposes of selecting, the green box is the best.