Issue with animation control - .start method doesn't work

Hello All !
I am working on a project in my work, we are using babylon.js. I am not allowed to show some stuff, but I hope I will tell everything clearly.

BRIEF:
I am working on a Trawl project. I have glb file with trawl and animations.
In sandbox everything works fine. I have 2 animations which have the same amount of frames, time etc. One is for Left side, other for right side. Let’s say mirror reflection.
const leftPart = scene.getAnimationGroupByName(“animationName_Left”);
const rightPart = scene.getAnimationGroupByName(“animationName_Right”);

function triggered by click on button -
leftPart.start(false,0.4,102/fps,203/fps,false);
rightPart.start(false,0.4,102/fps,203/fps,false);

Ok, and the right side works fine, it goes from 102 to 203 and stops, but the left one doesn’t work. I don’t have any errors in the concole, when i console.log(leftPart) i get the info about animations group etc, and what’s more when I tried in the same function :
leftPart.play(true)
the animations worked fine, from start to end, and then again because of the true in loop .

And here comes the question. Why the animation doesnt work with .start method , but with .play it does? Why one animation works with start but the other doesnt ? Is it some issue with glb file? But on the other in sandbox everything looks fine . Where should I look or check ?

If you need more info I will try to give you them. For me it is strange situation, I worked with many projects before, in every project there were animations and I used .start method with no problems . This is the first time .

I will read any suggestions with pleasure .
Have a Great Day!
Greetings ,
Eryk

This is really weird. From the above, I can only imagine that somehow the leftPart animation has already started and came to an end before you instruct to start it. Else, this really doesn’t make sense.
What if you try first stop the animation on load. See if this does anything. I guess you did check that you do not have another animation group of the same name? But even then, looping the animation shouldn’t change anything.

1 Like

Thanks for answering!
Yeah, I triple checked the names. I don’t have other with the same name. Both groups have 405 frames.
As you said I will try to first stop on load. We will see :wink:

Well, I paused the animation. I event tried .reset() , but still the same thing.
Really strange stituation.

These from and to parameter irritates me, do you really want to animate

lets say you have fps = 60
from frame 1.7
to frame 3.383

So you animate about 1.6 frames of your 405 frames. Will you recognize this small difference in motion? Maybe try without dividing by fps?

Thank you for the feedback!
I have fps = 60 , you are right . I did it beacause the 3D graphic designer wrote me the animation is prepared for 60 fps . Also I dont need to use animation like in your example from 1.7 to 3.3 - only 100 frame ranges , but I will keep it in mind for the future! I will try without dividing , but as I wrote before , second animations works perfectly fine.

ok, I just realized that 1.7 and 3.383 are frames divided by fps :sweat_smile:
I tried without dividing, and still nothing happens :confused:

There has been some changes about 6month ago to normalize the timing of animation imported from blender. However, in your case it should not make any difference. The key point here is that you have two identical animations/animationGroup. One is working and the other not. I believe they are not blended together, yes? As you said you did check on the animation name. Guess you also checked on the nodes names (if eventually you have a transform node or an abstract mesh of the same name).

Sure you cannot set-up a repro in the PG? Simply using your skeleton and the part with just these two animations? I don’t think this would endanger the secrecy of your project, would it?

Just a guess but could one animation block the other because they access same bones/nodes/meshes? It was the case on my project, so i had to focus animations on specfic targets.

You can try to only run one animation and stop the other at all, like scene.stopAllAnimations(), to test the one that doesnt work at all.

Also you can double check animationGroup-Names in sandbox.


The names are almost the same, only one has L , the other R in the name, I triple checked the names and copied to the project.

One is working and the other not.

One works with .play and .start but the other only with .play , and nothing happens with .start .

You can try to only run one animation and stop the other at all, like scene.stopAllAnimations(), to test the one that doesnt work at all.

I will try this :slight_smile:

Sure you cannot set-up a repro in the PG? Simply using your skeleton and the part with just these two animations? I don’t think this would endanger the secrecy of your project, would it?

I have never set-up before but I will try my best .

Sorry, I don’t know what to say. So, the meshes and animations come from c4d? I’m also using c4d, not so much for animations but still… Don’t see why it wouldn’t work. Did you try change the names of meshes or the order in the hierarchy. May be there’s been a bug on export. I found c4d sometimes caches some fancy information and next creates an issue on save or export. Eventually, I had to fusion a scene into another blank scene to get rid of these fancy bugs. But aside from that, and within BJS, I wouldn’t know and I doubt anyone else will be able to answer without a repro.

Do not be sorry . I appreciate your commitment . Both of you :slight_smile:
Yeah, I gues it came from c4d but I did not do it. I talked with 3D graphic designer who did it and he said that if it works in sandbox he has no clue what can be wrong also.
the feeling that it should work but it doesn’t is the worst :sweat_smile:

You can use this playground as draft for your repro:

I don’t know how and why, but
when I did :
leftPart.reset();
leftPart.stop();
leftPart.start(false,0.4,102/fps,203/fps,false)
it worked !
Before I used only reset or only stop. never both
What a strange situation .
Thank you all again for help ! :slight_smile:
Have a great day

1 Like

@eryk_wk can you share your repro as it feels like a bug ?

If I did read your posts correctly, you said you used ‘pause’ (not ‘stop’). Using only stop without the reset should work, doesn’t it?

To be honest , right now I do not remember what have I used . I guess you were right that I used pause instead of stop. Sometimes I forgot that different but similar word changes everything . Yes , it works with only stop now.