Jump to content

babylon js attachToBone and changing animations


Koroldev
 Share

Recommended Posts

5 hours ago, adam said:

Sorry, but I not fully understood about your dialog with Deltakosh. I am not strong in English :) it is working example? or what it is? because this code stop all my animations on the scene

var Animatable = BABYLON.Animatable;

Animatable.prototype.stop = function (animationName) {
    var idx = this._scene._activeAnimatables.indexOf(this);
    if (idx > -1) {
        if (animationName) {
            var animations = this._animations;
            var numberOfAnimationsStopped = 0;
            for (var index = animations.length - 1; index >= 0; index--) {
                if (typeof animationName === "string" && animations[index].name != animationName) {
                    continue;
                }
                animations[index].reset();
                animations.splice(index, 1);
                numberOfAnimationsStopped++;
            }
            if (animations.length == numberOfAnimationsStopped) {
                this._scene._activeAnimatables.splice(idx, 1);
                if (this.onAnimationEnd) {
                    this.onAnimationEnd();
                }
            }
        }
        else {
            this._scene._activeAnimatables.splice(index, 1);
            var animations = this._animations;
            for (var index = 0; index < animations.length; index++) {
                animations[index].reset();
            }
            if (this.onAnimationEnd) {
                this.onAnimationEnd();
            }
        }
    }
};

 

Link to comment
Share on other sites

  • 4 weeks later...

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Loading...
 Share

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...