Mesh Builder working on preview, but not phone
I'm working on a lens where there is a part that involves the user drawing a polygon by tapping locations on the screen. I get the position of the taps and convert that into a position for the MeshBuilder. This works fine on the preview, but on my google pixel it doesn't show any mesh. I know that the positions are correct because when I hardcode a mesh into the MeshBuilder with the same positions as what it is calculating for the taps, it works fine. Is this a bug, or am I doing something wrong?
The script is very long, but I'm basically just appending vertices interleaved, appending the index for it, and building the mesh for each point to a MeshBuilder on Line Strip mode, and afterwards calculating the indices to connect to fill in the shape and building a mesh in Triangles mode. This works perfectly on preview and only works with hardcoded numbers on my phone.
Hi 19nsandiso,
Hmm how are you converting your screen position to the vertex position?
Are you drawing in screen space or in world space?
Can you also try logging your touch and/or vertex input on device using:
https://lensstudio.snapchat.com/guides/scripting/debugging/
and seeing if they're the same as what you see in the Preview panel?
Thanks in advance!
Jon
I was messing around with it and found out that it has something to due with using multiple mesh builders on the same mesh. I can now get it to show the final shape, but it still isn't showing the line strip on my phone.
Glad to hear you figured out the first part!
Ah, we are currently fixing an issue related to this. In the meantime, you can use MeshTopology.Lines as a substitute. The only difference is that we have to append an extra index which will be the starting point of the next line. In the case of LineStrip, after the first index you can just add every index twice. E.g.