AR add button play animation

how to make button to play animation like this PlayCanvas | HTML5 Game Engine but i want to add a button on AR

here’s my project https://playcanvas.com/editor/scene/1042344

@yaustar can you help me to solve this. what functions should be added to run the animation when pressing a button? :smile:

Hi @Dann,

To get you started with the Playcanvas UI, take a look at the following samples. The User Interface - Buttons tutorial in particular can be helpful for you:

https://developer.playcanvas.com/en/tutorials/?tags=ui

Looks like you have a callback on the button press but all it does is set a property to true but that property is not used elsewhere.

From a quick look, it be easier to play the animation in the ui:playAnimation event callback instead.

1 Like

did you mean like this?

 button1.onclick = function (event) {
        self.app.fire('ui:playAnimation');
        var playanimation = this.app.root.findByName('Character');
        playanimation.animation.play('angry.glb');
    };

can artoolkit use 2d screens?

Should be able to

thank you it work