If you are a new Irrlicht Engine user, and have a newbie-question, this is the forum for you. You may also post general programming questions here.
sevans
Posts: 6 Joined: Thu Mar 01, 2007 6:00 am
Post
by sevans » Fri Mar 02, 2007 11:42 pm
Hi,
I am new to Irrlicht. I have been working through the Irrlicht tutorials. There is information in tutorial 7 for picking based on the camera. How can I do picking based on mouse clicks? Is there a tutorial or reference for this? I have done it using OpenGL before so I figure it must be possible.
Thanks,
-sevans
raven_coda
Posts: 89 Joined: Thu Aug 17, 2006 8:11 pm
Location: Salt Lake City, UT, USA
Contact:
Post
by raven_coda » Sat Mar 03, 2007 12:39 am
Here's an example,
Code: Select all
core::position2d<s32> mouse_pos=Device->getCursorControl()->getPosition();
core::line3df line=Device->getSceneManager()->getSceneCollisionManager()->getRayFromScreenCoordinates(mouse_pos, Device->getSceneManager()->getActiveCamera());
IsceneNode* object=smgr->getSceneCollisionManager()->getSceneNodeFromRayBB(line);
Definition of an Upgrade: Take old bugs out, put new ones in.
sevans
Posts: 6 Joined: Thu Mar 01, 2007 6:00 am
Post
by sevans » Sun Mar 04, 2007 5:57 pm
Ah that makes perfect sense.
Get the mouse coord on screen, use a ray and the col. detection system to find out what is the first object at those coords on the screen.
Thanks a bunch raven_coda