#2140 physics test

This commit is contained in:
Bachir Soussi Chiadmi 2023-06-16 10:50:39 +02:00
parent c56929901c
commit b4ab835250

View File

@ -1781,7 +1781,8 @@ export default {
let dir = this.pos.x > this.canvas.width/2 ? 1 : -1; // get the direction to the closest side let dir = this.pos.x > this.canvas.width/2 ? 1 : -1; // get the direction to the closest side
let dist = (dir < 0 ? this.pos.x : this.canvas.width - this.pos.x); // get the distance from the side let dist = (dir < 0 ? this.pos.x : this.canvas.width - this.pos.x); // get the distance from the side
let ori_pos = {x:this.canvas.width/2, y:this.body.position.y}; let ori_pos = {x:this.canvas.width/2, y:this.body.position.y};
let x_force = Math.pow(dist/700,10) * dir; let x_force = Math.pow(dist/700,100) * dir;
Matter.Body.applyForce( Matter.Body.applyForce(
this.body, this.body,