- Home /
deleting a face of a proceduraly created mesh.
hello everyone, I was wondering if there is a way to get the index of a certain variable in a list or array. i need this for getting all of the vertices in a corner of a proceduraly generated cube and being able to change their positions. thanks a lot in andvanced
Your question is a little unclear... all the vertices of a cube are "in a corner" - that's how you define a cube. So you can loop through mesh.vertices and change each vertex as you want. See http://docs.unity3d.com/ScriptReference/$$anonymous$$esh-vertices.html for an example.
you are right that all the verts in a cube are in the corners, sorry for being unclear. What I ment is that, since there are several vertices per corner and in the same place, thoght that perhaps there was a way get all vertices in a certain position to move them all. thanks a lot for pointing that out.
What is your starting point? Do you know the array index of the vert?
Answer by jmgek · Dec 22, 2014 at 07:31 AM
Two things, I have been doing work on vectors and tris for almost a month and it is extremely difficult if you don't fully understand it, it is almost impossible to understand how to work verts, if you wanted to grab a corner you need to get the vert that joins where you need the index and pull it into a simple function. To do that you could check where a bunch of your trangles meet or you could pull a random number from the array. or even use a raycast.
yeah, i am noticing its a bit of a pain in the ass to create and edit a mesh in code. guess all I can do is try to understand it. thanks a lot