My click events work in safari and chrome. But when I fire up quicklook, the model does not register click events on buttons.
What exactly registers the click events in the quicklook USDZ file?
Is it a raycast and a mesh?
And when does this get blocked?
What is a good practise for USDZ click events?
For instance, do I need colliders / meshes on buttons?
Hey there! QuickLook has its own internal raycasting engine, it’s effectively a black box. We can just provide it with triggers (e.g. “tap this object”) and actions (e.g. “play an animation/sound”)
You don’t need any colliders/buttons - but one thing to keep in mind is that QuickLook seems to treat all objects as colliders and approximates them with what I believe to be box-shaped boundaries
So in some cases you get better behaviour by splitting up meshes so that their axis-bounding boxes are smaller, and also sometimes you may need to add invisible objects as triggers that extend beyond what your visible button is.
An invisible trigger can e.g. be an object with opacity = 0 and alpha masking = 0.5 (so it ends up being invisible but can still be tapped and trigger events in QuickLook)
I also have some issues when I use the everywhere action to activate an object, instead the trigger (button) gets deactivated after clicking. SO it seems that it is stuck on “hide self”
as if the script is compiled without serializations.
I had similar problem with “Toggle On Click” (I will send a bug report next week, I promise). I had the impression, that the click fires twice, and if “toggle on click” it activates the target, and then deactivates it in the next frame. Out of curiosity - @The camel does it activate your “Active”-Target correctly, if you remove the checkmark from “toggle on click” ?
I had also issues with animations not looping, but that could be something else. I just struggle with the USDZ pipeline in general but that could be me
Yes, When I have Toggle On Click on false, it works as it should work. So it’s just click to activate.
But when I try to activate and deactivate targets I need Toggle On Click on true. In this case the object with the script dissapears if tapped. Perhaps due to an error the object gets deleted?
Next release will have significantly better SetActiveOnClick and Toggle behavior. There’s a few caveats that I’ll try to document better (that were already there before but made things pretty uncontrollable in some of the cases you described)
One thing is strange, when toggle is active I cannot change the other bools, but I can when toggle is on false. Perhaps this is on purpose. Also if you make documentation about this, can you add what the Target State toggle does?
Thanks for this update! makes my life already much easier.