Access to vertices of a mesh?

Just wonder if is it possible ??

If reached at the moment the vertexBuffer of my model but i cant find anything else.

btw the vertex count there is larger than my model vertex count posible for a convertion at importing to playcanvas.

Any help would be great.

Vertex buffers contain not just positions, but many other pieces of information. If you use Dev Tools to inspect vertexBuffer and it’s definition, it will give you more hints on what’s inside.

Hi Max

Thks for the fast answer

after reading you feedback I keep looking and I can’t find something that looks like a list of vertex, there is plenty information about other Graphix variables though.

Another search makes me try to use the function Lock of the vertex buffer but it seems that the returned array of bytes must be converted to a compatible format after returning it but can’t find a piece of information about these in the reference

Also, the vertex iterator makes me think that there must be a way to access my vertex list.

Thks a lot for the help

Correct, you can modify vertex buffer by locking it and using iterator.

It’s probably would be good if we had a Tutorial project to do that.


Update: Maybe it would help someone

// I get the vertex buffer and I fill a Vertex iterator with it 
this.itera = new  pc.VertexIterator(this.entity.model.model.meshInstances[0].mesh.vertexBuffer);
// i check the number of values in the element POSITION
this.puntos = this.itera.element.POSITION.array.length;
// and last i cicle througth them 
for(i = 0;i < this.puntos;i++ )

Im not sure what dos it mean each value I’m about to try X,e Y , Z ,X ,Y, Z and try to print the values

1 Like

It Worked !!!

You should press space for it to work. My model was made with blender so i had to change Y and Z axis and the final Z multiply it for -1.

1 Like