|
@@ -142,7 +142,6 @@
|
|
this.debug = d;
|
|
this.debug = d;
|
|
this.mass = 8;
|
|
this.mass = 8;
|
|
this.velocity_threshold = 0.01;
|
|
this.velocity_threshold = 0.01;
|
|
- this.moving = true;
|
|
|
|
// define radius regarding entries length
|
|
// define radius regarding entries length
|
|
switch(true){
|
|
switch(true){
|
|
case this.entrees.length > 1 & this.entrees.length <= 3:
|
|
case this.entrees.length > 1 & this.entrees.length <= 3:
|
|
@@ -208,7 +207,7 @@
|
|
// console.log(_physics.playing);
|
|
// console.log(_physics.playing);
|
|
// }
|
|
// }
|
|
if(!this.p.resting()){
|
|
if(!this.p.resting()){
|
|
- this.checkVelocity();
|
|
|
|
|
|
+ this.checkVelocityThreshold();
|
|
this.checkWallBouncing();
|
|
this.checkWallBouncing();
|
|
this.updatePos();
|
|
this.updatePos();
|
|
}
|
|
}
|
|
@@ -218,17 +217,11 @@
|
|
this.draw();
|
|
this.draw();
|
|
};
|
|
};
|
|
|
|
|
|
- Node.prototype.checkVelocity = function(){
|
|
|
|
|
|
+ Node.prototype.checkVelocityThreshold = function(){
|
|
if (Math.abs(this.p.velocity.x) < this.velocity_threshold
|
|
if (Math.abs(this.p.velocity.x) < this.velocity_threshold
|
|
&& Math.abs(this.p.velocity.y) < this.velocity_threshold){
|
|
&& Math.abs(this.p.velocity.y) < this.velocity_threshold){
|
|
- // console.log('checkVelocity stoping',this.p.velocity);
|
|
|
|
this.p.velocity.multiplyScalar(0);
|
|
this.p.velocity.multiplyScalar(0);
|
|
- // this.moving = false;
|
|
|
|
- // console.log('checkVelocity particule is resting',this.p.resting());
|
|
|
|
}
|
|
}
|
|
- // else{
|
|
|
|
- // this.moving = true;
|
|
|
|
- // }
|
|
|
|
};
|
|
};
|
|
|
|
|
|
Node.prototype.checkWallBouncing = function(){
|
|
Node.prototype.checkWallBouncing = function(){
|