# Mesh data : vertices edges faces

Hi people!
I need to access mesh data. I want to capture and move a vertice around when I touch it with another object. I got this to work relatively well, but sometimes things go funny. I think the problem is that a vertice is actually composed of a few vertices with idividual faces etc (cube has 4 ve times 6 faces = 24 ve in the meshproxy).
So if you want to move a point on the cube, you need to capture 3 vertices in the meshproxy… follow?

Anyway I was wondering if I can access edge and/or face data to see what goes wrong when it does. Or at least what vertices are grouped where…

Any help would be appreciated.
Thanks %|

hi skapie,

i had the sam eproblem as you with cubes but figured out how to do grids…

``````

### vertex tester/ you can play with them ####

#for v_index in range(mesh.getVertexArrayLength(0)):
#			vertex = mesh.getVertex(0,v_index)
#			vxyz= vertex.getXYZ()
#			print v_index, vxyz

#v0 = mesh.getVertex(0,13)
#v0pos = v0.getXYZ()
#v0.setXYZ([v0pos[0],v0pos[1],v0pos[2]+own.timer/2])

#v1 = mesh.getVertex(0,2)
#v1pos = v1.getXYZ()
#v1.setXYZ([v1pos[0],v1pos[1],v1pos[2]-own.timer/5])

#v1 = mesh.getVertex(0,2)
#v1pos = v1.getXYZ()
#v1.setXYZ([v1pos[0],v1pos[1],v1pos[2]-own.timer/5])

``````

this prints off the name[number] of each vertex, then you can do what ever you want with them, the numbers are kind of odd though- youd expect them to go from 1-5, 6-10, 11-15 e.t.c on a 5x5 grid but they dont.

i dont know if this will help its fairly basic and you probly know this already[ and nicked from somewhere on this site]

the numbers are kind of odd though- youd expect them to go from 1-5, 6-10, 11-15 e.t.c on a 5x5 grid but they dont.

Hey,
see that’s the thing, for different objects, the meshproxy and therefore the grouped vertices are totally different and (it seems like) randomly ordered. That’s why I wondered if it’s possible to access the edge or face data, not just a long list of vertices. :o
I think I’m gonna follow your advice and print a list of vertices which corresponds to the same XYZ and then assume that they are grouped together, but this is very manual and I would have to do it for every mesh I want to manipulate…

If there is a way to access that information please let me know.

:o Gulp
ok, so I printed out the indices of the vertices which has the same XYZ positions, and I have a huge problem.
I tested several different icospheres and 1 UVsphere. If the vertices are grouped according to position then I’m totally confused.
The vertices were grouped in different numbers. Sometimes grouped into groups of 7 or sometimes 3 or 2 and even 1.

I also tested a cube, but there everything seemed fine (8 groups representing the 8 points on a cube, each containing 3 vertices, corresponding to the three edges coming together on the mesh)

I don’t understand why spheres are so random. Does anyone have a clue how these things are calculated? I would have thought that there is some kind of math behind it but it seems totally illogical.

I fear that not many people will have a clue about any of this…

two options:

• the game engine is converting the mesh to strips [triangle strips or quad strips]
• the game engine is converting the mesh into indexed triangles

both of these are used to minimize redundancy of the mesh data sent to the graphics card [so it sends less data, so it renders faster].