puck - circle body
This commit is contained in:
parent
1990d98aa2
commit
30f2d99716
@ -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();
|
||||
}
|
||||
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user