mouse-picking

Cesium: picking entity and retrieving info of WMS

不问归期 提交于 2020-05-29 07:19:20
问题 I have developed a 3D viewer of buildings. What I'm trying to add now is the selection of the content of a WMS (Web Map Service) below the building entities. Basically, I want to be able to select the building at the position were the user left clicks. The colour of the building should change (which works). And I want to retrieve the information of the Web Map Service at the position were the user clicked. This is what I have coded so far: var pickColor = Cesium.Color.CYAN.withAlpha(0.7); var

Cesium: picking entity and retrieving info of WMS

霸气de小男生 提交于 2020-05-29 07:19:10
问题 I have developed a 3D viewer of buildings. What I'm trying to add now is the selection of the content of a WMS (Web Map Service) below the building entities. Basically, I want to be able to select the building at the position were the user left clicks. The colour of the building should change (which works). And I want to retrieve the information of the Web Map Service at the position were the user clicked. This is what I have coded so far: var pickColor = Cesium.Color.CYAN.withAlpha(0.7); var

GPU Picking inconsistent across devices

孤者浪人 提交于 2020-04-17 22:33:14
问题 I’m trying to implement GPU picking with Points using code I modified from the latter half of this article https://threejsfundamentals.org/threejs/lessons/threejs-picking.html It’s been working fine for me on desktop, but I started testing different browsers and devices and it doesn’t work consistently. I made a Codepen to illustrate https://codepen.io/deklanw/pen/OJVVmEd?editors=1111 body { margin: 0; } #c { width: 100vw; height: 100vh; display: block; } <canvas id="c"></canvas> <script type

gpu picking - invisible pixels around sprites

﹥>﹥吖頭↗ 提交于 2020-01-11 04:06:08
问题 I'm rendering a picking scene that contains sprites. As my cursor gets close to the sprite, it registers as a color and gets "picked". This invisible border gets larger closer you zoom into the sprites. Open up your console to see the IDs printed in real time. Move your cursor closer and further away to large and small sprites. You'll see that sprites get selected on an invisible border. This behavior does not happen with regular geometry, just with sprites. It's weird because I'm rendering

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

大城市里の小女人 提交于 2019-12-17 10:34:15
问题 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

get mouse in world coordinates with 2 gluUnproject calls to create ray

£可爱£侵袭症+ 提交于 2019-12-13 01:23:15
问题 I try to use what many people seem to find a good way, I call gluUnproject 2 times with different z-values and then try to calculate the direction vector for the ray from these 2 vectors. I read this question and tried to use the structure there for my own code: glGetFloat(GL_MODELVIEW_MATRIX, modelBuffer); glGetFloat(GL_PROJECTION_MATRIX, projBuffer); glGetInteger(GL_VIEWPORT, viewBuffer); gluUnProject(mouseX, mouseY, 0.0f, modelBuffer, projBuffer, viewBuffer, startBuffer); gluUnProject

OpenGL moving vertices with mouse

时光毁灭记忆、已成空白 提交于 2019-12-12 01:13:14
问题 I am using legacy OpenGL and trying to move vertices around with the mouse. To test whether a vertex is clicked on I loop through all vertices and multiply them by the model and projection matrix before dividing by the w value. This works fine and is shown below: for (Vertex *vertex : context->getMesh().vertices) { QVector4D vert(vertex->xPos, vertex->yPos, vertex->zPos, 1.0f); QVector4D transformedVert = projectionMatrix * modelMatrix * vert; transformedVert /= transformedVert.w(); if (

Ray Sphere Intersections in OpenGL

前提是你 提交于 2019-12-10 16:53:48
问题 I'm trying to use ray-sphere intersections to perform mouse picking in OpenGL. I found a few formulae online, and the last one I tried was one suggested by a user on Stack Exchange: Ray-Sphere intersection From what I've understood of this answer, I'm checking if the quadratic equation has positive roots. I don't really care where the intersection takes place, just if the ray intersects the sphere at all. My code is as follows, but doesn't seem to work. bool Mesh::useObject(vec3 camera, vec3

XNA 2D mouse picking

只谈情不闲聊 提交于 2019-12-10 10:48:01
问题 I'm working on a simple 2D Real time strategy game using XNA. Right now I have reached the point where I need to be able to click on the sprite for a unit or building and be able to reference the object associated with that sprite. From the research I have done over the last three days I have found many references on how to do "Mouse picking" in 3D which does not seem to apply to my situation. I understand that another way to do this is to simply have an array of all "selectable" objects in

XNA 2D mouse picking

青春壹個敷衍的年華 提交于 2019-12-06 08:43:25
I'm working on a simple 2D Real time strategy game using XNA. Right now I have reached the point where I need to be able to click on the sprite for a unit or building and be able to reference the object associated with that sprite. From the research I have done over the last three days I have found many references on how to do "Mouse picking" in 3D which does not seem to apply to my situation. I understand that another way to do this is to simply have an array of all "selectable" objects in the world and when the player clicks on a sprite it checks the mouse location against the locations of