decreased velocities on map #2150

This commit is contained in:
Bachir Soussi Chiadmi 2023-10-06 11:33:22 +02:00
parent 7fb5244d1c
commit 8c126fbe26

View File

@ -489,7 +489,9 @@ export default {
Matter.Body.setPosition(this.body, this.pos);
// add init velocity
this.setInitBodyVelocity()
// INFO no need of init velocity as each mapitems are repeling the each others
// this.setInitBodyVelocity()
// console.log('concernementItem mass', this.body.mass);
Matter.Composite.add(this.matterEngine.world, this.body);
// console.log('concernement body', this.body);
@ -500,7 +502,7 @@ export default {
}
},
setInitBodyVelocity(){
let delta = 50;
let delta = 5;
Matter.Body.setVelocity(this.body, {
x: -delta + Math.random()*delta*2,
y: -delta + Math.random()*delta*2
@ -1883,10 +1885,10 @@ export default {
? this.canvas.width - pseudo_center_x
: pseudo_center_x;
// X force decrsinsing near the center
// X force decreasing near the center
// max and min force
let xminf = 0;
let xmaxf = 1 + Math.random()*4;
let xmaxf = 1;// + Math.random()*4;
// scale factor
let xscale = (xmaxf-xminf) / (maxp-minp);
let x_force = Math.exp(xminf + xscale*(dist-minp)) * dir;
@ -1904,7 +1906,7 @@ export default {
// Friction air fa (increasing near the center)
let fa_minf = 0;
let fa_maxf = 6;
let fa_maxf = 20;
// scale factor
let fa_scale = (fa_maxf-fa_minf) / (maxp-minp);
let fa = Math.exp(fa_minf + fa_scale*(dist-minp)*-1);
@ -1960,7 +1962,8 @@ export default {
// X max and min force
let xminf = 0;
let xmaxf = 4 + Math.random()*3;
// let xmaxf = 4 + Math.random()*3;
let xmaxf = 2 + Math.random()*2;
// scale factor
let xscale = (xmaxf-xminf) / (maxp-minp);
@ -1970,7 +1973,8 @@ export default {
// y_velocity = Math.random() > 0.5 ? -y_velocity : y_velocity;
// X max and min force
let yminf = 1;
let ymaxf = 2 + Math.random()*4;
// let ymaxf = 2 + Math.random()*4;
let ymaxf = 4 + Math.random()*2;
// scale factor
let yscale = (ymaxf-yminf) / (maxp-minp);