mouse-picking

OpenGL ES (iPhone) Touch Picking

ぐ巨炮叔叔 提交于 2019-12-04 03:21:37
问题 Looking to do classic OpenGL mouse picking in ES. I'd prefer not to use third party libs, GLU ports and OpenGL name stacks, etc, are out. This pretty much leaves inverse view transformation and ray intersection, correct? I've gotten pretty far with the help of: http://trac.bookofhook.com/bookofhook/trac.cgi/wiki/MousePicking http://eigenclass.blogspot.com/2008/10/opengl-es-picking-using-ray-boundingbox.html . . .but I'm not there yet. This also reeks of THERE MUST BE AN EASIER WAY!! Here is

How to convert mouse coordinate on screen to 3D coordinate

六月ゝ 毕业季﹏ 提交于 2019-11-30 00:02:12
问题 I'm creating a 3D application using GLUT in C++. Now, I want to implement a method similar to this: Vector3* MyClass::get3DObjectfromMouse(int mouseX, int mouseY); How can I implement this method? 回答1: As it was commented by Andon M. Coleman, one way you can achieve this is by doing a ray/object intersection test, with unprojected screen coordinates. This technique is commonly known as picking . A pseudo-C++ code for picking: Assume we have a 3D object type/class: class Object3D { ... }; A 3D

How do I find my mouse point in a scene using SceneKit?

非 Y 不嫁゛ 提交于 2019-11-27 11:51:07
I have set up a scene in SceneKit and have issued a hit-test to select an item. However, I want to be able to move that item along a plane in my scene. I continue to receive mouse drag events, but don't know how to transform those 2D coordinates into 3D coordinate in the scene. My case is very simple. The camera is located at 0, 0, 50 and pointed at 0, 0, 0. I just want to drag my object along the z-plane with a z-value of 0. The hit-test works like a charm, but how do I translate the mouse point from a drag event into a new position in the scene for the 3D object I am dragging? You don't need