How do I properly use the Snap-Method in the MeshVisual?
Context of what I'm trying to achieve:
I'm trying to reveal a hole in the wall by revealing it with 3D-Animation.
My current approach:
To mask it to the wall I've currently been using the occluder object to give it the camera texture. but animating it doesn't really look that well. My desired effects would be to project current state of the texture to the mesh, so it looks like it's displacing the wall.
I've also tried using the copyFrame method with the renderTarget to get the current frame, but that uses the whole cameraRender as a texture, which doesn't give me the projection as the occluder material does.
My question/Challenge:
Is there any way of getting the current frame from the occluder as a texture. It does seem like that's what the snap-method does. The current API isn't really that clear on what it does. and I haven't been able to get it working properly. Is there anyone who have used it, or are there perhaps more examples on how it's to be used?
Am I maybe looking at the wrong method? Or has anyone had the same challenge as me and tackled it any other way? Would love some suggestions! :)
Thanks!
Hey Elliot,
That's a nice effect that you're looking for and we already made this is one of our templates.
If you open the Marker Template.
In the resources panel you can see there is a prefab called ExplosionEffect, you can drag and drop it under the Image Marker [EDIT_ME] object to see it works automatically.
This is how it works:
In the Marker Template there is a script called Helper Functions.
This script is all you need to do a single frame capture using:
or capture live target using:
You just need to have that script somewhere in your project file. Then, you can have another script like example below to get the snap from a frame.
In this code you just specify a mesh and then reference to helper function then it will do it on Lens Turn On. Make sure also create the references needed for HelperScript. You can always look at the Marker Template to see how does it works and let me know if you have any questions.
Hope this will help.
Cheers,
Amir.
Thanks for the in-depth reply Amir!
I'll have a look at that template! :)
Also here is the best way to export HelperScript from Marker Template for your project:
Cheers.