tag:blogger.com,1999:blog-1197731814546897181.post1947699608097905603..comments2019-02-15T09:24:55.556-08:00Comments on Ray picking on Android: Anonymoushttp://www.blogger.com/profile/09008984631349701347noreply@blogger.comBlogger36125tag:blogger.com,1999:blog-1197731814546897181.post-61159761587602579792019-02-15T09:24:55.556-08:002019-02-15T09:24:55.556-08:00+ Need implementation for GLES20, thanks!+ Need implementation for GLES20, thanks!Anonymoushttps://www.blogger.com/profile/12676074682125010949noreply@blogger.comtag:blogger.com,1999:blog-1197731814546897181.post-9144809225545796762018-02-26T03:01:12.735-08:002018-02-26T03:01:12.735-08:00How do I implement this using GLES20? Will it work...How do I implement this using GLES20? Will it work?Anonymoushttps://www.blogger.com/profile/12392922716508398048noreply@blogger.comtag:blogger.com,1999:blog-1197731814546897181.post-10543832925394314062016-05-11T02:35:07.340-07:002016-05-11T02:35:07.340-07:00Hi I'm just working my way through your tutori...Hi I'm just working my way through your tutorial and I'm just wondering where does the code for converting the co-ordinates go?Anonymousnoreply@blogger.comtag:blogger.com,1999:blog-1197731814546897181.post-78226530028630132912016-02-19T13:09:22.694-08:002016-02-19T13:09:22.694-08:00Nice post Game VectorNice post <a href="http://www.apktub.com/2015/11/vector-game-full-apk-file-download-free.html" rel="nofollow">Game Vector</a>Nouman ullah baighttps://www.blogger.com/profile/05878777934578653438noreply@blogger.comtag:blogger.com,1999:blog-1197731814546897181.post-19944872575767756032014-03-26T04:25:56.192-07:002014-03-26T04:25:56.192-07:00Hy Kev , can you send to me application when you p...Hy Kev , can you send to me application when you press the touchscreen, select a 3D object? min3d I set to work, and I loaded the 3d object obj mtl sites and texture, and I want to select an object when pressed tin touch an object, give me a menu arete for example ... can you help me?Anonymoushttps://www.blogger.com/profile/01561286086684754345noreply@blogger.comtag:blogger.com,1999:blog-1197731814546897181.post-86252782761774184662014-03-07T18:00:48.282-08:002014-03-07T18:00:48.282-08:00Fantatically useful post, thank you so much.
One ...Fantatically useful post, thank you so much.<br /><br />One issue I did find is that the view matrix has been applied twice to each ray endpoint. The multiplyMV transform shoild be removed, as the unproject already does this<br /><br />Thanks againKevnoreply@blogger.comtag:blogger.com,1999:blog-1197731814546897181.post-75477939516914826642014-02-05T03:55:00.234-08:002014-02-05T03:55:00.234-08:00hey, i have trouble with testing 3D ray picking......hey, i have trouble with testing 3D ray picking...<br />Can i get some example source code by e-mail?<br />Here is my e-mail address : id_identity@naver.com<br />Please answer me as soon as possibleMJnoreply@blogger.comtag:blogger.com,1999:blog-1197731814546897181.post-73250162388919303592013-11-08T05:54:19.187-08:002013-11-08T05:54:19.187-08:00Sorry there is a typo there.
*in which class I sh...Sorry there is a typo there. <br />*in which class I should actually put the code blocks? madanhttps://www.blogger.com/profile/12457485240005358587noreply@blogger.comtag:blogger.com,1999:blog-1197731814546897181.post-2049331074159345472013-11-08T05:53:08.615-08:002013-11-08T05:53:08.615-08:00Hi Thanks for the tutorial! I am finding it a bit ...Hi Thanks for the tutorial! I am finding it a bit hard to find out where to actually put the code that you explained above. Can you tell me in class I should actually put the code blocks that you have shown here? or if you have a working example can you share it please??<br /><br />Thanks in advance!<br /><br /><br />madanhttps://www.blogger.com/profile/12457485240005358587noreply@blogger.comtag:blogger.com,1999:blog-1197731814546897181.post-74145772983868255602013-04-21T05:48:45.035-07:002013-04-21T05:48:45.035-07:00I actually have, i have correct math and info how ...I actually have, i have correct math and info how to make ray picking and how to make it work for any nr of objects at any rotation or any coordinates.<br /><br />I just have to port it to Java.adminhttps://www.blogger.com/profile/10827265227385462347noreply@blogger.comtag:blogger.com,1999:blog-1197731814546897181.post-61856839055928688042013-04-20T11:07:49.575-07:002013-04-20T11:07:49.575-07:00Has anyone got a working sample of this? Sorry to...Has anyone got a working sample of this? Sorry to ask but I am struggling to implement it. I have used colour picking before but would like to try this method<br />thanks<br />SimonSimon Burfieldhttps://www.blogger.com/profile/01142095027418643626noreply@blogger.comtag:blogger.com,1999:blog-1197731814546897181.post-68105532441139427562013-01-29T16:11:35.740-08:002013-01-29T16:11:35.740-08:00Hi,
I am trying to use the above code to find whi...Hi,<br /><br />I am trying to use the above code to find which face of the cube I clicked. I am not understanding how to call intersectRayAndTriangle method. can you please help me to understand this or can you share your test project to test the code on a cube with me. My mail id is sushil.blore@gmail.comSushilnoreply@blogger.comtag:blogger.com,1999:blog-1197731814546897181.post-34485007136470268042012-11-28T09:14:50.116-08:002012-11-28T09:14:50.116-08:00Thanks a lot!, I think this is just what i need to...Thanks a lot!, I think this is just what i need to get out of the hole i'm in.<br /><br /> But, there are some things i do not understand.<br /><br />When you convert your cube, what's is going on there, do you get a normal vector of the cube like if it was a triangle? and what happens to those vectors? Are those the ones creating the triangle?.<br /><br />Sorry for my english :P<br /><br />Thanks a lot by the way for sharing.Jorge Franknoreply@blogger.comtag:blogger.com,1999:blog-1197731814546897181.post-79762806313847190312012-11-20T10:15:39.393-08:002012-11-20T10:15:39.393-08:00http://nehe.gamedev.net/article/using_gluunproject...http://nehe.gamedev.net/article/using_gluunproject/16013/<br />In the above link they are not using "ray", but using <br />glReadPixels( x, int(winY), 1, 1, GL_DEPTH_COMPONENT, GL_FLOAT, &winZ );<br /><br />Will it not work with Android? I am trying to use it. Please suggest.Anonymoushttps://www.blogger.com/profile/16783277298665453547noreply@blogger.comtag:blogger.com,1999:blog-1197731814546897181.post-43180399908373422502012-11-20T10:07:23.224-08:002012-11-20T10:07:23.224-08:00Can you please tell me how can I use intersectRayA...Can you please tell me how can I use intersectRayAndTriangle() method with convertedSquare. By converting cube to Square what do you mean? How you are converting I do not understand? Please explain. After conversion I believe, the output are 6 squares, so how you are going to use it with triangle. I am new to OpenGL. I know cube can be created with Triangles. So do you mean to call intersectRayAndTriangle() method 2 times for the 2 triangles of each face of cube.<br />Any help will appreciated.<br />Anonymoushttps://www.blogger.com/profile/16783277298665453547noreply@blogger.comtag:blogger.com,1999:blog-1197731814546897181.post-79063683979098227042012-11-14T06:07:09.384-08:002012-11-14T06:07:09.384-08:00I am at work so do not have my code in front of me...I am at work so do not have my code in front of me, and can not remember if this is the error you get if you "pop" more times than you have "pushed"? maybe not.<br /><br /><br /> Anonymoushttps://www.blogger.com/profile/09008984631349701347noreply@blogger.comtag:blogger.com,1999:blog-1197731814546897181.post-79797118346308975802012-11-14T05:40:26.827-08:002012-11-14T05:40:26.827-08:00I have not really had time to get back to my code ...I have not really had time to get back to my code and finish it off, will try in the coming year<br />Anonymoushttps://www.blogger.com/profile/09008984631349701347noreply@blogger.comtag:blogger.com,1999:blog-1197731814546897181.post-19419672499565401512012-11-14T00:46:45.121-08:002012-11-14T00:46:45.121-08:00I have copied the code and it really works. Howeve...I have copied the code and it really works. However, sometimes the code crashes. I get presenting "stack_underflow" exception when "MatrixTrackingGL.glPopMatrix" <br />is executed.<br /><br />Do you have any idea how can I fix it ?<br /><br /><br />java.lang.IllegalArgumentException: stack underflow<br /> at min3d.core.MatrixStack.preflight_adjust(MatrixStack.java:164)<br /> at min3d.core.MatrixStack.glPopMatrix(MatrixStack.java:115)<br /> at min3d.core.MatrixTrackingGL.glPopMatrix(MatrixTrackingGL.java:525)<br /> at min3d.core.Renderer.drawObject(Renderer.java:527)<br /> at min3d.core.Renderer.drawScene(Renderer.java:344)<br /> at min3d.core.Renderer.onDrawFrame(Renderer.java:151)<br />at android.opengl.GLSurfaceView$GLThread.guardedRun(GLSurfaceView.java:1516)<br />at android.opengl.GLSurfaceView$GLThread.run(GLSurfaceView.java:1240)<br />Dimitrios Ververidishttps://www.blogger.com/profile/06572139103772148521noreply@blogger.comtag:blogger.com,1999:blog-1197731814546897181.post-32324088836935437762012-11-08T05:00:45.462-08:002012-11-08T05:00:45.462-08:00Calculation of the intersections in 3d for a numbe...Calculation of the intersections in 3d for a number of faces is very aggravating especially in Java. I've simplified the calculation of the coordinates of bringing in one plane and see if there is a touch point in the contour of the object. Then you can use to test the simple conditions ifelsesierocinskihttps://www.blogger.com/profile/15199606014315024982noreply@blogger.comtag:blogger.com,1999:blog-1197731814546897181.post-75807297389660468992012-09-20T23:19:56.150-07:002012-09-20T23:19:56.150-07:00Do you have a Google play link to your game? Inter...Do you have a Google play link to your game? Interesting to see it.<br /><br />Thank you for detailed instructions, I've implemented picking objects by your tutorial.<br /><br />However, I have a major recommendation for you. For your code to be applicable I've slightly modified it for better memory usage. It is very important in game not to allocate memory too much because GC causes lockups of process, and current implementations allocates a lot of memory.<br />For example, allocating new float[] on vector +/- operations is crazy.<br />I've modified it to return value into already created arrays, like this:<br /><br />public class Vector<br />{<br /> // dot product (3D) which allows vector operations in arguments<br /> public static float dot(float[] u, float[] v) {<br /> return ((u[X] * v[X]) + (u[Y] * v[Y]) + (u[Z] * v[Z]));<br /> }<br /><br /> public static void minus(float[] u, float[] v, float[] result) {<br /> result[X] = u[X] - v[X];<br /> result[Y] = u[Y] - v[Y];<br /> result[Z] = u[Z] - v[Z];<br /> }<br /><br /> public static void addition(float[] u, float[] v, float[] result) {<br /> result[X] = u[X] + v[X];<br /> result[Y] = u[Y] + v[Y];<br /> result[Z] = u[Z] + v[Z];<br /> }<br /><br /> public static void scalarProduct(float r, float[] u, float[] result) {<br /> result[X] = u[X] * r;<br /> result[Y] = u[Y] * r;<br /> result[Z] = u[Z] * r;<br /> }<br /><br /> public static void crossProduct(float[] u, float[] v, float[] result) {<br /> result[X] = (u[Y] * v[Z]) - (u[Z] * v[Y]);<br /> result[Y] = (u[Z] * v[X]) - (u[X] * v[Z]);<br /> result[Z] = (u[X] * v[Y]) - (u[Y] * v[X]);<br /> }<br /><br /> // mangnatude or length<br /> public static float length(float[] u) {<br /> return (float) Math.abs(Math.sqrt((u[X] * u[X]) + (u[Y] * u[Y]) + (u[Z] * u[Z])));<br /> }<br /><br /> public static final int X = 0;<br /> public static final int Y = 1;<br /> public static final int Z = 2;<br />}<br /><br />Also there are quite a lot of allocations in static intersectRayAndTriangle() method, I've made a non-static version of it which uses pre-allocated float[] arrays.<br />Hope my comments help you, and once again thank you for a good tutorial!Oleksandr Popovhttps://www.blogger.com/profile/16416641029130574652noreply@blogger.comtag:blogger.com,1999:blog-1197731814546897181.post-34842456306622499182012-08-31T09:45:50.304-07:002012-08-31T09:45:50.304-07:00Sorry about the no replys... I have been away on h...Sorry about the no replys... I have been away on holiday. I cannot place the whole example as its a game I made.Anonymoushttps://www.blogger.com/profile/09008984631349701347noreply@blogger.comtag:blogger.com,1999:blog-1197731814546897181.post-75528632940501411172012-08-29T03:00:48.880-07:002012-08-29T03:00:48.880-07:00Cab you please provide working sample code for it?...Cab you please provide working sample code for it?Anonymousnoreply@blogger.comtag:blogger.com,1999:blog-1197731814546897181.post-31124812139199112092012-08-23T18:05:35.866-07:002012-08-23T18:05:35.866-07:00Nevermind. Figured out.
I created a test project ...Nevermind. Figured out.<br /><br />I created a test project to test your code on a cube. Worked well but sometimes I notice intersectRayAndTriangle returning 0 even when I click right on top of the cube. It might be something to do with the ModelViewMatrix. In my test project, I had onDrawFrame of Renderer class record current matrix state using matrixGrabber.getCurrentState(gl) as the last line.Android Guynoreply@blogger.comtag:blogger.com,1999:blog-1197731814546897181.post-84457297327188030152012-08-21T20:16:27.664-07:002012-08-21T20:16:27.664-07:00Hi Gregory,
Nice work there. Thanks for sharing.
...Hi Gregory,<br /><br />Nice work there. Thanks for sharing.<br /><br />I am little bit stuck with the part on what to do once I have a Ray (P0, P1). My objects are spheres so I need to test if the Ray cut the sphere. Like how do I get the converted square and do I still use Triangle to test intersection. Any help would be appreciated.<br /><br />ThanksAndroid Guynoreply@blogger.comtag:blogger.com,1999:blog-1197731814546897181.post-49155457482352102662012-08-07T13:15:51.212-07:002012-08-07T13:15:51.212-07:00This comment has been removed by the author.Anonymoushttps://www.blogger.com/profile/09008984631349701347noreply@blogger.com