How would I implement 2 physics engines with Scene Management

Hope everyone is well, I am trying to use 2 physic engines, “arcade” and “matter”, and also change between Scenes however I keep getting an error “add of undefined”. It only recognises one physic engine and not the other. Really been struggling for the past 3 days and any help would be much appreciated.

Hey @Faizan_Ali,

Can you please show the config of your game and also console error ? :slight_smile:

var game;
var config;

config = {
type: Phaser.AUTO,
width: 800,
height: 600,
parent: ‘phaser-example’,
physics: {
arcade: {
debug: true,
gravity: { y: 200 }
},
matter: {
debug: true,
gravity: { y: 0.5 }
}
},
scene: Scene1
};

game = new Phaser.Game(config);

Here is the error I am getting: https://imgur.com/a/c1HOoXP

And here is my Scene1.js file

class Scene1 extends Phaser.Scene{
constructor(){
super(“playGame”);
}
preload ()
{
this.load.image(‘fuji’, ‘assets/fuji.png’);
this.load.image(‘block’, ‘assets/block.png’);
this.load.image(‘platform’, ‘assets/platform.png’);
}

create ()

{
// Matter JS:
this.matter.add.image(400, -100, ‘block’);
this.matter.add.image(360, -600, ‘block’);
this.matter.add.image(420, -900, ‘block’);

  this.matter.add.image(400, 550, 'platform', null, { isStatic: true });

  //  Arcade Physics:

  var block = this.physics.add.image(400, 100, 'fuji');

  block.setVelocity(100, 200);
  block.setBounce(1, 1);
  block.setCollideWorldBounds(true);

}
}

https://labs.phaser.io/edit.html?src=src\physics\multi\arcade%20and%20matter.js

Yes that is the code im using but I want to use it on different Scenes, so for example, I will have 3 scenes, one will be stage 1, then stage 2, then stage 3. But I want to use matter and arcade physics on 2 of the scenes.

And this is the error I am getting when I try to use it on a different Scene