Skip to content

Commit 9001bfd

Browse files
Merge pull request #7461 from 4ian/fix-animation-crossfade-switch-problem
fix "is finished" animation condition
2 parents 187018c + 0d2778c commit 9001bfd

File tree

1 file changed

+4
-1
lines changed

1 file changed

+4
-1
lines changed

Extensions/3D/Model3DRuntimeObject3DRenderer.ts

+4-1
Original file line numberDiff line numberDiff line change
@@ -371,14 +371,17 @@ namespace gdjs {
371371
}
372372
const previousAction = this._action;
373373
this._action = this._animationMixer.clipAction(clip);
374+
375+
// The action must be reset before being reconfigured with setLoop to prevent previous action parameters causing problems
376+
// such as animations not playing (not sure to which extends it can cause problems nor the origin of these problems)
377+
this._action.reset();
374378
this._action.setLoop(
375379
shouldLoop ? THREE.LoopRepeat : THREE.LoopOnce,
376380
Number.POSITIVE_INFINITY
377381
);
378382
this._action.clampWhenFinished = true;
379383

380384
if (previousAction && previousAction !== this._action) {
381-
this._action.enabled = true;
382385
this._action.crossFadeFrom(
383386
previousAction,
384387
this._model3DRuntimeObject._crossfadeDuration,

0 commit comments

Comments
 (0)