Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

removeSpring event is not fired #355

Open
RichardGale opened this issue Apr 12, 2020 · 0 comments
Open

removeSpring event is not fired #355

RichardGale opened this issue Apr 12, 2020 · 0 comments

Comments

@RichardGale
Copy link

from World.js

/**

  • Add a spring to the simulation
  • @method addSpring
  • @param {Spring} spring
    */
    World.prototype.addSpring = function(spring){
    this.springs.push(spring);
    var evt = this.addSpringEvent;
    evt.spring = spring;
    this.emit(evt);
    evt.spring = null;
    };

/**

  • Remove a spring
  • @method removeSpring
  • @param {Spring} spring
    */
    World.prototype.removeSpring = function(spring){
    var idx = this.springs.indexOf(spring);
    if(idx !== -1){
    Utils.splice(this.springs,idx,1);
    }
    };

Noticed while playing with the p2.renderer as that depend on the addSpring and removeSpring events. Removing springs does not remove them from the renderer.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant