getSceneNodeFromScreenCoordinatesBB( ) problems in 1.3

You discovered a bug in the engine, and you are sure that it is not a problem of your code? Just post it in here. Please read the bug posting guidelines first.
Post Reply
QuantumLeap
Posts: 38
Joined: Mon Sep 25, 2006 6:31 pm
Location: San Francisco, California

getSceneNodeFromScreenCoordinatesBB( ) problems in 1.3

Post by QuantumLeap »

I've been using Irrlicht for about one year and just updated from 1.2 to 1.3.

With irrlicht 1.2 I had a part of my code where a node should be picked.

Simplified version:

Code: Select all

scene::ISceneNode* selectedNode = NULL;
scene::ISceneNode* nodeToPick = (assign correctly the node, which is displayed with no problem);

nodeToPick->setID(8);

AND LATER...

core::position2di pos = device->getCursorControl()->getPosition();
selectedNode = smgr->getSceneCollisionManager()->getSceneNodeFromScreenCoordinatesBB(pos, 8);

selectedNode->setVisible(false) //that's not what I really do in the code, but here it serves a debugging purpose
This worked fine in Irrlicht 1.2. When I changed to 1.3, the idBitMask filter somehow ceased to work. Although all the nodes on the scene have a setID associated and only the ones I want to pick got an ID=8, the collision manager picks other nodes as well. Before you ask, yes I know how the bitmask thing works, and all the other nodes were assigned ID 0, 2 or 4.
Now if I do instead

Code: Select all

if (selectedNode->getID()==8)
{
selectedNode->setVisible(false)
}
Then it works. Of course, this invalidates the purpose of the bitmask on getSceneNodeFromScreenCoordinatesBB.

Again this worked fine with 1.2, something changed in CSceneCollisionManager.
It's easier to curse a candle than light the darkness
vitek
Bug Slayer
Posts: 3919
Joined: Mon Jan 16, 2006 10:52 am
Location: Corvallis, OR

Post by vitek »

What is the id of the scene node that is returned? If the following code prints a message, then Irrlicht is working as advertised...

Code: Select all

if (selectedNode->getID() & 8)
{
  printf("Irrlicht works and you're wrong! [nodeId=%x]\n", node->getID());
}
QuantumLeap
Posts: 38
Joined: Mon Sep 25, 2006 6:31 pm
Location: San Francisco, California

Post by QuantumLeap »

Vitek,


As I said in the post above, if I do

Code: Select all

if (selectedNode->getID() == 8) 
Then it works. But isn't this redundant? I mean, this completely invalidates the purpose of the bitmask on getSceneNodeFromScreenCoordinatesBB.
Before (with Irrlicht 1.2) it was working fine and now it isn't.
It's easier to curse a candle than light the darkness
vitek
Bug Slayer
Posts: 3919
Joined: Mon Jan 16, 2006 10:52 am
Location: Corvallis, OR

Post by vitek »

I'm not trying to 'fix' your problem yet, I'm trying to find out what is wrong. I'm not asking you to add the check to your production code. I want you to temporarily add it to see if the problem is on your end or in Irrlicht. If you copy the code as I wrote it and you get a message printed when you click a node that should not be selectable then the bug is not with Irrlicht. Just because it worked in Irrlicht 1.2 doesn't mean that it is a bug in Irrlicht 1.3.

I'm under the impression that you don't understand the way that a bitmask works or you are not setting the id for all nodes. If you don't set the id for a node, it defaults to -1 and it will always be selectable when you call getSceneNodeFromScreenCoordinates().

Travis
Robert Y.
Posts: 212
Joined: Sun Jan 28, 2007 11:23 pm

Post by Robert Y. »

It sounds to me it is the same bug as this one:
http://irrlicht.sourceforge.net/phpBB2/ ... hp?t=20087

You could try that fix, it worked for me.
Post Reply