Jump to content

Need help with displaying Vertices, Edges, and Faces at Runtime

Recommended Posts

So I'm working on making a runtime mesh editor and I'm trying to use the built in tools to show the vertices, edges and faces but I'm having a bit of trouble working with the API. After way too much digging I found the pb_ElementGraphics class which seemed to do what I want, along with a forum post about how to use it: 

I tried to do what was specified in the forum post but I couldn't get it to work. It seems as though the code has changed quite a bit since this post was made because the function used, pb_ElementGraphics.instance.BuildVertexMesh(), no longer works. I tried using pb_ElementGraphics.RebuildGraphics() but I can't figure out how to get that pb_Edge[][] distinct edge array, and even if I did I suspect I'm using this function incorrectly. The documentation is really unhelpful when it comes to topics like this, can somebody please explain to me how the pb_ElementGraphics class is used, and/or how I would go about displaying the vertex, edge, and face handles in runtime?

Share this post

Link to post
Share on other sites

RebuildGraphics won't work in the runtime without some modifications. However, you could accomplish the same thing by looking at the individual functions that build the preview meshes.

The distinctEdges parameter is built like so:

for(int i = 0; i < selection.Length; i++)
   m_universalEdges[i] = pb_EdgeExtension.GetUniversalEdges(pb_EdgeExtension.AllEdges(selection[i].faces), selection[i].sharedIndices);

Share this post

Link to post
Share on other sites

Please sign in to comment

You will be able to leave a comment after signing in

Sign In Now