Page 1 of 1

Irrlicht 1.2 & getSceneNodeFromScreenCoordinatesBB

Posted: Sat Dec 02, 2006 4:59 pm
by Magnet
Bug with getSceneNodeFromScreenCoordinatesBB does not fixed?
Why? This bug fixed in SVN.

Posted: Sat Dec 02, 2006 9:12 pm
by hybrid
Irrlicht 1.2 == Irrlicht SVN rev. 319

Posted: Sat Dec 02, 2006 9:32 pm
by vitek
What exactly is the problem that you are having? Have you read this thread?

Posted: Sun Dec 03, 2006 10:01 am
by Magnet
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

Code: Select all

position2di pos = device->getCursorControl()->getPosition();
hoveredSceneNode = smgr->getSceneCollisionManager()->getSceneNodeFromScreenCoordinatesBB(pos);

Posted: Sun Dec 03, 2006 10:04 am
by vitek
What exactly is the problem that you are having?

Posted: Sun Dec 03, 2006 10:06 am
by Magnet
Some objects in scene not detected by getSceneNodeFromScreenCoordinatesBB

Posted: Sun Dec 03, 2006 10:40 am
by vitek
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

Posted: Mon Dec 04, 2006 7:27 am
by neotoma
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

Posted: Mon Dec 04, 2006 8:32 am
by vitek
Could you _please_ make a simple testcase that illustrates the problem? I have written many tests to try and reproduce the problems that users have mentioned. I have yet to find one that shows a problem.

Travis

Posted: Mon Dec 04, 2006 8:47 am
by vitek
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.

Image