#2140 physics test
This commit is contained in:
parent
c56929901c
commit
b4ab835250
@ -1781,8 +1781,9 @@ export default {
|
||||
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 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(
|
||||
this.body,
|
||||
ori_pos,
|
||||
|
Loading…
x
Reference in New Issue
Block a user