Difference between revisions of "Tutorial - Picking"
(first draft using the Block layout. Added category tag.) |
|||
Line 1: | Line 1: | ||
+ | {{ContentBlock|width=800|color=white | ||
+ | |content={{!!}} | ||
== Picking the mesh under the mouse cursor == | == Picking the mesh under the mouse cursor == | ||
Line 45: | Line 47: | ||
</source> | </source> | ||
}} | }} | ||
+ | }} | ||
+ | [[category: Tutorials]] |
Revision as of 00:17, 17 April 2008
Picking the mesh under the mouse cursorPicking an object within the scene is a common problem. Supposing you want to select the object using a mouse the following sample will show you how you get the NodeHandle for the object under the mouse cursor. Based on the knight example in the Horde3D SDK we will first remove the mouseMoveListener. To enable the mouse cursor again we have to remove the Then we define a mouseButtonListener in the main.cpp:
For the use of Horde3DUtils::pickNode we have to normalize the window coordinates received by glfwGetMousePos. That's why we need to call glfwGetWindowSize additionally. Another conversion has to be made, since GLFW has it's origin in the upper left corner while Horde3D requires the origin to be in the lower left corner. Then in the app.cpp we implement a call to the pickNode method of Horde3DUtils.
|