Skip to content

Commit

Permalink
fix: Ball jumping continuously in a low height on the ground
Browse files Browse the repository at this point in the history
  • Loading branch information
NriotHrreion committed Oct 27, 2024
1 parent 1659b99 commit 9514623
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 2 deletions.
2 changes: 1 addition & 1 deletion src/simulator/objects/ball.ts
Original file line number Diff line number Diff line change
Expand Up @@ -113,7 +113,7 @@ export class Ball extends CanvasObject<RoundHitbox> {
public override update(delta: number) {
super.update(delta);

if(this.obj.y < this.render.canvas.height - Ground.GROUND_HEIGHT - this.radius) {
if(this.obj.y < this.render.canvas.height - Ground.GROUND_HEIGHT - this.radius * 2) {
this.removeForce("ground.support");
}

Expand Down
2 changes: 1 addition & 1 deletion src/simulator/objects/ground.ts
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@ export class Ground extends CanvasObject<GroundHitbox> {
if(vy.length > Ground.STABLE_VELOCITY) {
obj.velocity = Vector.add(vx, Vector.multiplyScalar(Vector.reverse(vy), Ground.DAMPING));
} else {
obj.velocity = vx;
obj.velocity.y = 0;
obj.applyForce("ground.support", Force.reverse(Force.gravity(obj.mass)));
}

Expand Down

0 comments on commit 9514623

Please sign in to comment.