Reset and play Anim

I have used reset() on an entity’s anim module. It is rewinding it as well, which is perfect, I then try to play the anim once reset and I get this error [loopTrigger.js?id=62608635&branchId=eaaa571e-2a02-4921-bb99-53294c6f2e58:27]: Uncaught TypeError: is not a function

In the API it says it is infact a function. AnimComponentLayer | PlayCanvas API Reference
What am I missing? Thanks,


Hi @groupsjrBrianDouglas,

Just to make sure, are you passing a state name in the form of a string when you call play()?

edit - Correction: state name


Adding in the parameter of the name as a string still does not make the function legit."loop");

Oh! I just noticed, the documentation you linked to isn’t on the Anim component itself, but the Anim Component Layer. You would have to go to the appropriate layer to call that particular play() function.

Here are the methods for the Anim Component itself:

2 questions, as I am new to programming the Anim component. 1 in terms of layers are we taking the hierarchy in terms of my previous. ON the link you just posted, I don’t see a play method. After I reset, how do I trigger the animation. I fired the appropriate setBoolean but it does nothing.

Does this line of code work for you? :;

This will trigger the animation to play on the base layer of the AnimStateGraph. This should work if you only have one animation layer.

Unfortunately, I haven’t been able to play with the Anim component much as I haven’t needed it. Someone else may chime in if this doesn’t work for you.

I hope this is helpful

Thanks you, I am very confused about layers in there an can find no practical documnetaion on this.

What I am trying to do, and perhaps I am getting this wrong, is reset a looping animation. When I switch out of it in my animationStateGraph, it stops it mid play and I see a flash. Do you know how I would resolve this?