Объект (элипс) использующий Маттер физику движеться, но игнорирует колизии

I was able to create an ellipse with physics, but for some reason there is no collision (for example, a collision with the walls). I do not have to move the ellipse, I need to check some collisions with it, but I came across the fact that no collisions with it occur. What am I doing wrong ?
Here is a sample code:

var config = {
type: Phaser.AUTO,
width: 800,
height: 600,
backgroundColor: ‘#efefef’,
parent: ‘phaser-example’,
physics: {
default: ‘matter’,
matter: {
debug: {
renderFill: false,
showInternalEdges: true,
showConvexHulls: true
}
}
},
scene: {
create: create
}
};

var game = new Phaser.Game(config);

function create ()
{
this.matter.world.setBounds().disableGravity();

const ellipse = this.add.ellipse(100,
50,
200,
100);
ellipse.setStrokeStyle(2, 0x1a65ac);
const points = ellipse.pathData.join(’ ')
this.shield = this.matter.add.gameObject(ellipse, {
shape: { type: ‘fromVerts’, verts: points, flagInternal: true }})
ellipse.setVelocity(6, 3);
ellipse.setAngularVelocity(0.01);
ellipse.setBounce(1);
ellipse.setFriction(0, 0, 0);

const rectangle = this.add.rectangle(100, 100, 50, 4, 0xaa00aa)
rectangle.property = this.property
const angle = rectangle.pathData.join(' ')  
const laser = this.matter.add.gameObject(rectangle, {shape: { type: 'rectangle', verts: angle,}})
laser.setVelocity(6, 0);
laser.setBounce(1);
laser.setFriction(0, 0, 0);

}

Hi, I was playing around with that some time ago, try using the “getPoints” from a Geom…

const ellipseGeom = new Phaser.Geom.Ellipse(100, 50, 200, 100);
const points = ellipseGeom.getPoints(64).map((p) => p.x + " " + p.y).join(" ");
1 Like

@Darko You have provided incredible help. This allowed me to move from my point of view. That’s what I have come to at the moment (click игра)

Glad to hear :slightly_smiling_face: and nice to see the progress!