Jump to content

  • Log In with Google      Sign In   
  • Create Account


How to do picking with mouse click on nodes in Irrlicht


Old topic!
Guest, the last post of this topic is over 60 days old and at this point you may not reply in this topic. If you wish to continue this conversation start a new topic.

  • You cannot reply to this topic
1 reply to this topic

#1 MARS_999   Members   -  Reputation: 1266

Like
0Likes
Like

Posted 02 February 2014 - 02:27 AM

I am not sure what function in ISceneCollisionManager I can use to do picking of objects.

I want to click on mesh nodes or whatever is on screen and get that object which was clicked on by the mouse pointer?

Thanks!



Sponsor:

#2 flammable   Members   -  Reputation: 275

Like
0Likes
Like

Posted 02 February 2014 - 04:20 AM

Hey,

 

The simplest method is using: ISceneCollisionManager::getSceneNodeFromScreenCoordinatesBB

This method only takes bounding boxes into consideration though, if you need more precision you should probably use

 line3d<f32> ray = colmgr->getRayFromScreenCoordinates(device->getCursorControl()->getPosition(), camera);

This returns a ray which goes though the camera and points to where the cursor is pointing, then use:

ISceneCollisionManager::getSceneNodeAndCollisionPointFromRay

to find the first scene node intersecting this ray

 

links:

http://irrlicht.sourceforge.net/forum/viewtopic.php?t=38725

http://irrlicht.sourceforge.net/docu/classirr_1_1scene_1_1_i_scene_collision_manager.html






Old topic!
Guest, the last post of this topic is over 60 days old and at this point you may not reply in this topic. If you wish to continue this conversation start a new topic.



PARTNERS