[Resolved]Manual scene node picking with a WOW-like camera

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.
Post Reply
benjani13
Posts: 25
Joined: Sat Aug 07, 2010 8:12 pm

[Resolved]Manual scene node picking with a WOW-like camera

Post by benjani13 »

Hello, I'm making a camera like in World of Warcraft: a camera always fixing the player SceneNode and rotate around it, with a mouse button to rotate the camera and the player SceneNode, another mouse button to only rotate the camera, and the wheel to zoom.

Except some details, my camera is functional. But I have a problem to manage the manual picking scene node (like in the 7th tutorial "collisions") with this camera. I tried a lot of things but it didn't work fine...

The known informations are the player scene node position, the camera position (with these two informations we can have the view direction), and the mouse cursor position on the window.

The problem is probably the 2D selection with the mouse cursor. I have to select a scene node in 3D, with a selection in 2D.

So, I'd like to know if you have a way to do that.
Thank you.
Last edited by benjani13 on Sat Sep 18, 2010 5:01 pm, edited 1 time in total.
Seven
Posts: 1034
Joined: Mon Nov 14, 2005 2:03 pm

Post by Seven »

benjani13
Posts: 25
Joined: Sat Aug 07, 2010 8:12 pm

Post by benjani13 »

Thank you very much! I can use this function for a ray/box detection:

Code: Select all

pickedNode = collMan->getSceneNodeFromScreenCoordinatesBB(m_device->getCursorControl()->getPosition(), IDFlag_IsPickable);
And these for a ray/box and ray/triangle detection:

Code: Select all

ray = collMan->getRayFromScreenCoordinates(m_device->getCursorControl()->getPosition(), camera);
pickedNode = collMan->getSceneNodeAndCollisionPointFromRay(ray, intersection, hitTriangle, IDFlag_IsPickable, 0);
Post Reply