Feasible -Dynamically create everywhere Animation actions at runtime before opening Quick Look/WebXR

For testing you can always just write buttonClickComp["stateAnimation"] for example to set or access members

Is there anything else I need to do to set that PlayAnimationOnClick script up at runtime?

by user 103054507105067008

but you shouldnt set them at all

all you need to set it the target, animator, stateName and stateNameAfterPlaying. You can try it in the browser. Does this work?
image.png

The private variables are private because they are internal state that is assigne when exporting to usdz from the public variables

I’m just testing in the browser, troubleshooting to see if anything else is breaking it first, the first animation autoplays and loops when I use the AnimatorController.createFromClips which is a good start

by user 103054507105067008

You can disable this with the second parameter (it exposes some options)

How do you make a new CreateAnimatorControllerOptions for that, I always get Cannot find name CreateAnimatorControllerOptions .

by user 103054507105067008

it’s just a type definition that’s why you cannot create a new object with “new”. You pass it in like so AnimatorController.createFromClips(this.clips!, { <options_you_want_to_override> });

Okay so in my case it was specific scene hierarchy issue where the button for PlayAnimationOnClick was not in the hierarchy underneath the WebAR session root etc so I fixed it by moving the button there - I’ll share a sample when I can to help others if anyone else is making their own model viewer for AR

by user 103054507105067008