Change the soundboard templatel to make 3D objects appear
Hi to everybody I looked at the soundboard template, I managed to make a mesh appear instead of a sprite, but i'm stuck . I managed to replace the sprite with a 3d object, now when i click the button, the object appears and when the sound ends ,as written in the code present in the template, it disappears.
I would like the object to remain on the screen and disappear only when I click on another button, but I can not figure out how to do it, I tried to put in the existing code another tapped function, with writing to make the object disappear but when I apply the changes, the object does not appear anymore ...... can you help me? Thank you so much
Cristian
Hi Cristian!
Happy to help. It sounds like you're not able to make the object appear anymore, because the original onTapped function is no longer being called. In Lens Studio, events can only be bound to one callback function at a time. For example, let's say you write something like this:
var tapEvent = script.createEvent("TouchStartEvent");tapEvent.bind(onTapped_A); // Will not get called on touch
tapEvent.bind(onTapped_B); // Will get called on touch
Only the function named onTapped_B will get called when the user touches the screen. The best way for you to add additional functionality when the user touches a button would be to directly modify the provided onTapped function.
Let me know if you have any other questions about modifying the Soundboard Template!
Best,
Peter
Thanks for the reply but I have no idea how to do what you advised me