Page 1 of 1

[SOLVED] Picking but not correctly...

Posted: Thu Mar 05, 2009 2:46 pm
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 ?

Posted: Thu Mar 05, 2009 4:11 pm
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

Posted: Thu Mar 05, 2009 5:07 pm
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().