Hi, I used physics and the PhysicsEditor to set up two collisions on the box image: vertices and circle.
I set the scale of 1 of 2 sprites to 0.5 and the vertices shrank but the circle did not.
When is the method wrong?
Is there any way to reduce circle?
Source
function preload() {
this.load.image('block', 'assets/block.png');
this.load.json('shapes', 'assets/box.json');
}
function create() {
this.matter.world.setBounds(0, 0, 854, 480);
const shapes = this.cache.json.get('shapes');
this.matter.add.sprite(200, 20, 'block', 'block', { shape: shapes.block });
this.matter.add.sprite(400, 20, 'block', 'block', { shape: shapes.block }).setScale(0.5);
}
const config = {
type: Phaser.AUTO,
parent: 'phaser-example',
width: 854,
height: 480,
scene: {
preload: preload,
create: create
},
physics: {
default: 'matter',
matter: {
debug: true
}
}
};
const game = new Phaser.Game(config);
Physics box.json file
{
"generator_info": "Shape definitions generated with PhysicsEditor. Visit https://www.codeandweb.com/physicseditor",
"block": {
"type": "fromPhysicsEditor",
"label": "block",
"isStatic": false,
"density": 0.1,
"restitution": 0,
"friction": 0.1,
"frictionAir": 0.01,
"frictionStatic": 0.5,
"collisionFilter": {
"group": 0,
"category": 1,
"mask": 255
},
"fixtures": [
{
"label": "",
"isSensor": false,
"vertices": [
[ { "x":3, "y":93 }, { "x":91, "y":94 }, { "x":95, "y":89 }, { "x":88, "y":0 }, { "x":4, "y":1 }, { "x":0, "y":6 } ],
[ { "x":95, "y":6 }, { "x":88, "y":0 }, { "x":95, "y":89 } ]
]
},
{
"label": "",
"isSensor": false,
"circle": {
"x": 48,
"y": 47,
"radius": 45.221676218380054
}
}
]