Matter Collision with Vertices

With polygone and verts

by ragesoft

HTML

<script src="https://cdnjs.cloudflare.com/ajax/libs/phaser/3.54.0/phaser.min.js"></script>
<div id="phaser-example">

</div>

JavaScript

var config = {
    type: Phaser.AUTO,
    width: 800,
    height: 600,
    backgroundColor: '#0f0f0f',
    parent: 'phaser-example',
    physics: {
        default: 'matter',
        matter: {
            gravity: {
                x: 0,
                y: 0
            },
            debug: {
            		showBody: true,
                showStaticBody: true,
                showCollisions: true,
              	showInternalEdges: true,
                showConvexHulls: true
            },
        }
    },
    scene: {
        preload: preload,
        create: create,
        update: update
    }
};

var txt;
var shapedata = [ {"x":179,"y":274}, {"x":135,"y":271}, {"x":108,"y":257}, {"x":88,"y":228}, {"x":19,"y":227}, {"x":19,"y":133}, {"x":90,"y":133}, {"x":90,"y":121}, {"x":41,"y":70}, {"x":109,"y":1}, {"x":179,"y":70}, {"x":222,"y":71}, {"x":244,"y":43}, {"x":309,"y":44}, {"x":320,"y":90}, {"x":322,"y":132}, {"x":354,"y":132}, {"x":392,"y":182}, {"x":355,"y":229}, {"x":322,"y":229}, {"x":318,"y":234}, {"x":317,"y":271}, {"x":312,"y":289}, {"x":311,"y":323}, {"x":228,"y":323} ];
var polydata = '179, 274, 135, 271, 108, 257, 88, 228, 19, 227, 19, 133, 90, 133, 90, 121, 41, 70, 109, 1, 179, 70, 222, 71, 244, 43, 309, 44, 320, 90, 322, 132, 354, 132, 392, 182, 355, 229, 322, 229, 318, 234, 317, 271, 312, 289, 311, 323, 228, 323';

var txtStyle = { font: '20px Corier', fill: '#ffff00'};

var game = new Phaser.Game(config);

function preload ()
{
    this.load.image('ship', 'https://examples.phaser.io/assets/sprites/phaser-ship.png');
    this.load.image('church', 'https://i.ibb.co/hCL7BtH/church.png');
    //this.load.atlas('space', 'assets/tests/space/space.png', 'assets/tests/space/space.json');
}

function create ()
{
		//debugger;
    // some text
    this.add.text(10,20,"Moving: Arrows", txtStyle);

		let settings = {
    	shape: {
      	type: 'fromVerts',
        verts: polydata,
      },
    	//vertices: shapedata,
      isStatic: 1,
    };
    this.church =...