|
Ok, I have some information to get the vertices that is something like this:
and some vertices(that means that some vertices wasn't added to this variable)are added to a variable
and I have a variable(j) that increments(j++;). And when it ends to check all the triangles I put something like this: mesh1.vertices = newvertices; this is my code:
what I am trying to do with this script is to find the vertices that have to be remove and like that have, first a list of vertices(already done and works perfectly), and second build triangles, and this is the part I need help. Help that works :P
(comments are locked)
|
|
I guess you don't understand what a vertexbuffer and a indexbuffer is? A simple example for a plane:
Look carefully at the example of the indices. The first and the third vertex is shared between both triangled. If you want remove some triangles you have to remove the 3 corresponding indices that made up the triangle. The resulting indices array will be smaller in the end. That's tricky because you can't change the size of builtin arrays dynamically. If you want to remove vertices somewhere in the middle of the vertices array it gets really difficult because the indices would be pointing to the wrong vertices. I still don't know exactly what you want to do. I'll hope you understand everything i explained here. Maybe you can specify you question a bit and tell us what you want to archive. I guess you've tried something similar in this post, right? Ok, i still don't understand what exactly you want to archive :D You said how to "find" a triangle. The loop where you increment your "j", it already goes through all triangles. "j" is the current triangle and (j*3), (j*3+1) and (j*3+2) are the 3 points that define this triangle. If you want to remove a single triangle you have to copy all triangle indices into a new array except those you don't want. You can't change the size of a builtin array. The new arraysize have to be reduced by 3. yeah, the real problem is at the final of the question, please read it
Jan 29 '11 at 03:25 PM
Uriel_96
OK, sorry for not explaining very well. I remove some of the vertices, and the vertices is all correct(the order and position), the bad thing comes in building the triangles, I don't know how to order my triangles, if it helps I will put all my code and a explication.
Jan 29 '11 at 09:47 PM
Uriel_96
(comments are locked)
|

I'm really sorry, but i won't continue on this. To describe your script with two words: a total mess. I've stopped searching for syntax errors after the tenth i've found. The whole script also contains a lot of logical errors even without the knowledge what the script should do. To use the Update function as a loop for a single task is just crazy. All your own arrays aren't created or initialized and you mixed up int arrays with ints... I don't see any light at the end of this tunnel. I would recommend to take some programming lessons or simply try to learn the syntax on your own. good luck
oh sorry, yeah I was wrong I did this bad, but I finally find a way, but thanks for answer, your answer really works.