From 30f2d9971631135863efe7470d01c63d7b9f4fe1 Mon Sep 17 00:00:00 2001 From: Pierre Date: Wed, 1 Oct 2025 14:13:48 +0000 Subject: [PATCH] puck - circle body --- src/entities/Puck.ts | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/src/entities/Puck.ts b/src/entities/Puck.ts index e63bea4..639abd4 100644 --- a/src/entities/Puck.ts +++ b/src/entities/Puck.ts @@ -39,6 +39,9 @@ export class Puck extends Phaser.GameObjects.Container { this.body.setSize(10, 10); this.body.setOffset(-5, -5); // Center the body on the container + // Prevent physics tunneling + this.body.setMaxVelocity(1000, 1000); + // Set initial velocity (5 m/s in a random direction for testing) const angle = 3.1415; //Math.random() * Math.PI * 2; const speed = 30 * SCALE; // 5 m/s converted to pixels/s @@ -51,6 +54,9 @@ export class Puck extends Phaser.GameObjects.Container { this.body.setBounce(1, 1); this.body.setCollideWorldBounds(true); + // Enable high-velocity collision detection + this.body.setCircle(5); // Use circular body instead of rectangle for better collision + this.createSprite(); }