I am making a project with templates and I am replacing the animation component with the new anim component, but I have a problem when I call that template with the anim component, because the component does not work, the model remains as if it did not have animations, here I attach my draft
you will see that there is a character that is saved as a template, called “char_1”,
When I start the game with that character, everything is fine, the animation works.
the problem comes when I try to instantiate that same template from my “Assets”, I wrote a function that does it for what tests is this:
crearPlayerTest();
running the function on the console will create the same character template, but the Anim component no longer works, as if it was disabled, hopefully someone can help me, thanks.
Hi @ignacio_padilla! I can’t find the function crearPlayerTest. In which script is it? Did you apply all needed changes to the template, because I see a script enabling is not applied to the template. This script seems to be controlling your anim state graph.
the function createPlayerTest is found in Assets / Files / SocketManager.js
The movePlayer.js script is deactivated because it is an MMO project and that script is in charge of the real-time movement of the character, but is activated with createPlayerTest function, the script that is in charge of the animations is in char_1/Body and is called pBody.js
Currently no animations have been added, but I don’t know if that is the intention. Other than that, I don’t see anything that stands out to me. Hopefully the PlayCanvas team can help you further.
Oh, I know what the issue could be. It’s possible that the anim component Root Bone reference is still referencing the same body Entity that was on the original template instance and not the new clone’s one
This is something we should fix. Thanks for raising and showing the workaround
Thanks Yaustar, yes, the problem is in Root Bone, it already works perfectly adding this line of code to instantiate a new template and add the body to the Root Bone of the new template.