opengl es 2.0 - Pixel based collision detection problem with OpenGLES 2.0 under Android -
Another issue, which can be added to the problem, or even the main problem, is that the two rectangular (two rectangular objects for my intersection) The dimensional space indicates each other) parts of the two bounding boxes, which are called OpenGL matrix matrix. Multiply MV was calculated with the use of functionality (code given below). Could it be that those two Android and OpenGL matrix computing methods are not equal? Cheers, Firstly note that your There is a bug in the code. You can not use SOURCE Matrix with destination and vector. Multiply MV () is identical (function will calculate an x coordinate correctly which it will overwrite in the source vector. However, it is used to calculate y, z and w coordinates of the original x Required - which is flawed in return.) Also note that it will be easier for you to use frontline areas for a previously identified confrontation move, because they have such a complex The matrix changes do not require the id. Again, to find the collision you should read with bitmap or textures. What you need to do is create a silhouette for your object (it is very easy, Silhouette Just the list of conditions). After that you need to create convex objects that fill (non-convex) silhouette. It can be obtained as an example ear clipping algorithm It can not be the fastest, but it is very easy to implement and will be done only once. Once you have convex objects, you can change your coordinates using the matrix and find out the confrontation with your world (you can use re-triangle are very good articles on intersections), and you Get the same accuracy as you can detect pixel based collision. I hope this helps ...
This is my first post, so apologize for any mistake.
I am developing a simple task, with the use of OpenGL ES 2.0 and Android 2.3, the game My game framework on which I am currently working on is based on two-dimensional practice which is present in a three-dimensional world. Of course, the knowledge of my world's organizations such as the situation in the fictional world, the float [] matrix, the OpenGL texture handles as well as Android's Bitmap Handle (I'm not sure it is necessary later because I am doing With the use of OpenGL machine, for retrieval, but for some time, for my convenience). This is the background on the problematic issue for a while.
I'm currently stuck with a pixel-based collision detection because I'm not sure which object (OGL texture here, or Android bitmap here) should sample me, I mean, I already have the bitmap of Android Have attempted to sample, but it has not worked completely for me - many run-time crashes regarding reading out of bitmap Of course, to be able to read pixels from bitmap, I used the bitmap.create method to use the phantom rendering properly. Here is the code snippet:
android.graphics.Matrix m = new android.graphics.Matrix (); If (o1.angle! = 0.0f) {m.setRotate (o1.angle); B1 = Bitmap.ScentBitmap (B1, 0, 0, B1getWidth), B1. Gatehit (), M, False); }
Matrix. RETATM (MTOxetate, 0, -Tongle, 0, 0, 1); // Original bitmap size, equal to spit size in its model space, // as well as world float [] rect = new float [] {origRect.left, origRect.top, 0.0f, 1.0f, origRect.right , OrigRect.top, 0.0f, 1.0f, origRect.left, origRect.bottom, 0.0f, 1.0f, origRect.right, origRect.bottom, 0.0f, 1.0f}; Android.opengl.Matrix.multiplyMV (rect, 0, mtxRotate, 0, rect, 0); Android.opengl.Matrix.multiplyMV (Rect, 4, MTXotet, 0, Rect, 4); Android.opengl.Matrix.multiplyMV (Rect, 8, MTXotet, 0, Rect, 8); Android.opengl.Matrix.multiplyMV (Rect, 12, MTXotet, 0, Rect, 12); // Calculating the bounding box of the object (it is necessary that the object has been rotated for the second time and now it is a rectangular border, its float left = rect [0]; float top = rect [1]; float right = ( Left, reset [i]); top = monastery (top, rect [i + 1]); right = monastery. Max (right, racket [i]); floor = monastery. Minute (bottom, rect [i + 1 ];}
Comments
Post a Comment