[SOLVED] Animation is not playing when pressing UI button

Yes, the screenshots looks correct.

To make the non Anim State Graph method work you need to remove your Anim State Graph from the anim component. This need to stay empty.

For some reason the car has open doors at start, but I can’t figure out why.

1 Like

Yea the car door is open for some reason i have been trying to figure it out too. Please let me know if you can figure it out.

And in the screenshots i didnt use the non Anim State Graph method i was using to initial state method that you did in the fork project for some reason your’s is working and mine is not. I dont know why I re added the graph file did everything from the starting then also it didnt work. Can you tell why it is not working by looking at my current project? PlayCanvas | HTML5 Game Engine

I forked your project again to be able to find the difference. Your transitions have an Exit Time of 1. For some reason this blocks the animation from playing. You need to set the Exit Time of both transitions to 0.

3 Likes

Thanks it worked now :slight_smile: thanks for support. It means a lot @Albertos

2 Likes

Because I was not happy with the playing animation at start, I did some extra research. It turns out that the behaviour is as expected, because it’s going from START to the first state when you start the game. Despite that, that’s not what we wanted. I have created a work around to prevent this.

  1. Make sure the Initial State is your Open Door animation, as that is the first animation that you need when the user decides to open the car doors.

    image

  2. Make transitions from ANY to the states and add the correct conditions.

  3. Disable the animations at initialize.

    image

  4. Enable the animations at button click.

    image

    PlayCanvas 3D HTML5 Game Engine

2 Likes

Honestly speaking i had thought of this idea before but i was unaware of this syntax as of now. Thanks @Albertos