Jump to content
  • Advertisement
Sign in to follow this  
MARS_999

How to do picking with mouse click on nodes in Irrlicht

This topic is 2084 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts

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!

Share this post


Link to post
Share on other sites
Advertisement

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

Share this post


Link to post
Share on other sites
Sign in to follow this  

  • Advertisement
×

Important Information

By using GameDev.net, you agree to our community Guidelines, Terms of Use, and Privacy Policy.

GameDev.net is your game development community. Create an account for your GameDev Portfolio and participate in the largest developer community in the games industry.

Sign me up!