Some Handy Code Snippets For Y'all
Hi!
I'm sharing some of my code snippets in this git (https://github.com/max-van-leeuwen/SnapLensStudio-CodeSnippets), feel free to use them!
There are example projects for all of them, and at the top of the script there is more information commented.
Some examples of what you can find there:
- Mesh Copy, this reads all the vertex information of a mesh and then rebuilds the mesh using MeshBuilder.
- Texture Sampler, a function which you simply give a texture and a screen position and it returns the color at that pixel.
- VoiceML Simple Transcribe, a lightweight setup to instantly get the user's voice transcription!
- Portal, an easy way to make one-way portals that the user can walk through!
Comments
-
Hi, thank you for posting this but the git link doesnt link to git
0 -
@forwARdgame said:
Hi, thank you for posting this but the git link doesnt link to gitAre you sure? The link still works for me! I added it in text next to it in this post, maybe that helps
0 -
Hi Max,
Thanks for the useful code snippets !!!
Especially for mesh copy.Unfortunately, many methods are poorly documented in the help.
E.g. :
https://docs.snap.com/api/lens-studio/Classes/Assets/#RenderMesh--MethodsextractVerticesForAttribute(String attributeName) : Number[]
Returns a list of values of each vertices in the RenderMesh for the specified attribute.How did you know that the Arrtibutes are "position" "normal" and "texture0"?
Is there any other documentation that I don't know about?Cheers,
Mike1 -
-
Cool!
0