Accessing vertexes

Godot Version

4.5.1

Question

I want to access a Mesh3D’s vertexes, and I know how to do it in shaders, but I don’t know how to do it in gdscript… Any ideas how?

I think it could be with MeshStance3d.Mesh.surface_get_arrays. The documentation for this method indicates where to find the parameter to include to obtain the vertices.

Thank you :slight_smile:

You can’t access them directly from script because they are “locked away” in gpu memory.
surface_get_arrays will copy the entire vertex buffer from gpu to cpu memory. If you want to make visible changes, you’ll need to upload it all back to gpu memory. This is an expensive operation and it shouldn’t be done on frame-by-frame basis, especially if there’s a large amount of vertex data in the buffer.

Yea… Maybe I stay at shaders…

Vertices is plural for vertex :wink:
Cheers!

2 Likes

This topic was automatically closed 30 days after the last reply. New replies are no longer allowed.