[SOLVED] Picking but not correctly...

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
Linaxys
Posts: 47
Joined: Tue Feb 24, 2009 10:46 pm

[SOLVED] Picking but not correctly...

Post by Linaxys »

Hello,
I try to pick an object like this everytime I click on it :

Code: Select all

		ISceneNode *sel = cynScene->getSceneCollisionManager()->getSceneNodeFromScreenCoordinatesBB(cynDevice->getCursorControl()->getPosition(),0);
		if (sel && sel != planeNode && sel != skybox && sel != cynCamera && sel->getID() == OID_OBJECT) {
			printf("ITSOK\n");
		}
I set my breakpoint on the printf, and the debugger break here ONLY when I pick very near the center of my mesh... If I try to pick an edge and a little closer, it doesn't pick...

How can I pick on every point of a mesh please ?
Last edited by Linaxys on Thu Mar 05, 2009 5:07 pm, edited 1 time in total.
Strong99
Admin
Posts: 687
Joined: Fri Mar 31, 2006 7:06 pm
Location: Netherlands
Contact:

Post by Strong99 »

it sounds like you bounding box isn't the right size.

getSceneNodeFromScreenCoordinatesBB gets mesh from the Boundig box (BB)

using getCollisionResultPosition or getCollisionPoint does collision detection on the triangles
Linaxys
Posts: 47
Joined: Tue Feb 24, 2009 10:46 pm

Post by Linaxys »

Sorry for the disturb, it was for a browser plugin and I forgot that the Irrlicht's screen position was badly positionned from the original HWND handle.

To fix that I was just using the GetCursorPos and ScreenToClient function to get the real cursor position instead of getCursorControl()->getPosition().
Post Reply