Inside CSceneCollisionManager

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
juliusctw
Posts: 392
Joined: Fri Apr 21, 2006 6:56 am
Contact:

Inside CSceneCollisionManager

Post by juliusctw »

Not sure if this is a bug or it was intended this way but

Inside CSceneCollisionManager, the method

void getPickedNodeBB(...)

if you have an octTree game Level, this method will almost always pick the octTree as the closest (when in fact it is not) and the collision detection then doesn't work very well.

i personally just turned it off at the end of the method but that's a pretty bad implimentation, but i thought you guy might want to take notice of it.

if(current->getType() != 7)
if (distance < outbestdistance)
{
outbestnode = current;
outbestdistance = distance;
}
vitek
Bug Slayer
Posts: 3919
Joined: Mon Jan 16, 2006 10:52 am
Location: Corvallis, OR

Post by vitek »

If the camera is inside a box, then that box will likely be picked first. That is why you have the bitmask parameters. You can tell the scene manager which nodes, or node types, that you want to exclude from picking.

All you need to do is specify a bit that indicates nodes that are pickable, and set the id for nodes that you want to be pickable to include this bitmask. Remove the bit from nodes that you don't want to be pickable.

Code: Select all

#define PICKABLE 0x800000000

// set node1 to be pickable
node1->setID(node1->getID() | PICKABLE);

// set node2 to not be pickable
node2->setID(node2->getID() & ~PICKABLE);

// select from the pickable nodes
scene::ISceneNode* picked =
  cmgr->getSceneNodeFromScreenCoordinatesBB(mouse, PICKABLE);
Another thing that you could do would be to apply the scene node filter patch that I wrote up a while back. It allows more fine grained control over the scene nodes that are pickable.

Travis
Phant0m51
Posts: 106
Joined: Mon Jan 15, 2007 6:07 am

Post by Phant0m51 »

Check out this thread here. It explains alot about using Bitmasks to pick objects.
Post Reply