I tested the animations in the three js editor, and they look like this:
While in the game, when I play the animation, it looks like this:
What am I doing wrong? And how can I fix it? I’m updating the mixer with clock.getDelta()
I tested the animations in the three js editor, and they look like this:
While in the game, when I play the animation, it looks like this:
What am I doing wrong? And how can I fix it? I’m updating the mixer with clock.getDelta()
Incomplete or missing animation may happen if several clock.getDelta()
are used in a single rendering loop (e.g. there are several characters and each of them is calling getDelta
). Is this the case?
Yes it is. So making a new delta for each of them would solve it?
In a rendering loop clock.getDelta()
should be called only once. If you have 3 mixers, they should all use the same delta:
function animation( )
{
var delta = clock.getDelta( );
:
mixer1.update( delta );
mixer2.update( delta );
mixer3.update( delta );
}
I’m doing this. I’m calling clock.getDelta() inside the animation, storing it in the const delta, and using it for every character, like that mixer2.update(delta)…
I got the impression that there are several clock.getDelta()
in the rendering loop. If not, then the problem is something else.
function animate() {
const animationId = requestAnimationFrame(animate)
renderer.render(scene, camera)
const delta = clock.getDelta();
characters.forEach((character) => {
scene.add(character.getModel());
character.updateSides();
character.update(delta);
});
There’s only one, I’m certain.
I’m not sure:
characters
array contain – if it is mixers, then what is updateSlides
, if it is not mixers, then where how are the mixers’ updatedAs it is hard for me to guess so many things, I hope that someone else might be helpful.
characters array contains every character, which is a class, which has the method .update which calls mixer.update(delta). Updatesides is another method, which I use to update every frame the sides of the model, for collision purposes. Why I add the model to the scene every frame is a good question, I don’t know why… maybe I can change this but every other animations work properly, just this for the shooting that is kinda odd… so I don’t know if adding them every scene is the problem… You have any other idea?
No more ideas, besides some approaches, that only someone with access to the code and to the model can try:
Hey man, thank you really for the help. The issue was that I was playing the animation while still playing the animation to stand still, so they end up being bugged. Really glad that you helped me. About that magic ray rotation, still a no go. But thanks for the help there too <3