Clicking on a scene Node

You are an experienced programmer and have a problem with the engine, shaders, or advanced effects? Here you'll get answers.
No questions about C++ programming or topics which are answered in the tutorials!
Post Reply
Tom

Clicking on a scene Node

Post by Tom »

I recently found IRRLICHT , i must say it looks a very nice engine i found it v easy to get started doing stuff , one thing that i have been trying to do , if i import a mesh to create an scene node im just wondering is there a way to detect or show when its clicked on ? , i know i can detect when the camera is over it with collision detection but im looking to go off the mousepointer i.e keep the camera static , i know how to get the x,y coords of the mouse is there a way to see if their over a node?

Thanks for help
saigumi
Posts: 921
Joined: Fri Aug 22, 2003 11:31 am
Location: St. Louis, MO USA
Contact:

Post by saigumi »

This is the function you want.

Code: Select all

virtual ISceneNode* irr::scene::ISceneCollisionManager::getSceneNodeFromScreenCoordinatesBB  (  core::position2d< s32 >    pos,  
  s32    idBitMask = 0 
 )  [pure virtual] 
 
   Returns the scene node, which is currently visible under the overgiven screencoordinates, viewed from the currently active camera. The collision tests are done using a bounding box for each scene node. 

Parameters: 
pos:  Position in pixel screen coordinates, under which the returned scene node will be.  
idBitMask:  Only scene nodes with an id with bits set like in this mask will be tested. If the BitMask is 0, this feature is disabled.  

Returns: 
Returns the visible scene node under screen coordinates with matching bits in its id. If there is no scene node under this position, 0 is returned.  
Crud, how do I do this again?
buhatkj
Posts: 444
Joined: Fri Dec 12, 2003 4:53 am
Contact:

also check out the collision example for this..

Post by buhatkj »

in that example you can see this in use, for the picking of which faerie to have their lighting disabled. also a neat kinf of picking that shows which trangle the camera is looking at withing the node for the level, was very enlightening to me...
-ted
My irrlicht-based projects have gone underground for now, but if you want, check out my webcomic instead! http://brokenboomerang.net
Post Reply