# How would I implement 2 physics engines with Scene Management

**URL:** <https://phaser.discourse.group/t/how-would-i-implement-2-physics-engines-with-scene-management/1789>\
**Category:** Phaser 3\
**Created:** [March 22, 2019, 8:06pm UTC](https://phaser.discourse.group/t/how-would-i-implement-2-physics-engines-with-scene-management/1789 "2019-03-22T20:06:19Z")\
**Posts on this page:** 7\
**Page:** 1

<div class="post-metadata">

**Author:** ![Faizan\_Ali](https://yyz2.discourse-cdn.com/free1/user_avatar/phaser.discourse.group/faizan_ali/32/964_2.png) [@Faizan\_Ali](https://phaser.discourse.group/u/Faizan_Ali)\
**Post date:** [March 22, 2019, 8:06pm UTC](https://phaser.discourse.group/t/how-would-i-implement-2-physics-engines-with-scene-management/1789/1 "2019-03-22T20:06:19Z")

</div>

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.

---

<div class="post-metadata">

**Author:** ![hcakar](https://yyz2.discourse-cdn.com/free1/user_avatar/phaser.discourse.group/hcakar/32/459_2.png) [@hcakar](https://phaser.discourse.group/u/hcakar)\
**Post date:** [March 22, 2019, 11:07pm UTC](https://phaser.discourse.group/t/how-would-i-implement-2-physics-engines-with-scene-management/1789/2 "2019-03-22T23:07:45Z")

</div>

Hey @Faizan_Ali,

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

---

<div class="post-metadata">

**Author:** ![Faizan\_Ali](https://yyz2.discourse-cdn.com/free1/user_avatar/phaser.discourse.group/faizan_ali/32/964_2.png) [@Faizan\_Ali](https://phaser.discourse.group/u/Faizan_Ali)\
**Post date:** [March 22, 2019, 11:27pm UTC](https://phaser.discourse.group/t/how-would-i-implement-2-physics-engines-with-scene-management/1789/3 "2019-03-22T23:27:24Z")

</div>

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](https://imgur.com/a/c1HOoXP)

---

<div class="post-metadata">

**Author:** ![Faizan\_Ali](https://yyz2.discourse-cdn.com/free1/user_avatar/phaser.discourse.group/faizan_ali/32/964_2.png) [@Faizan\_Ali](https://phaser.discourse.group/u/Faizan_Ali)\
**Post date:** [March 22, 2019, 11:27pm UTC](https://phaser.discourse.group/t/how-would-i-implement-2-physics-engines-with-scene-management/1789/4 "2019-03-22T23:27:57Z")

</div>

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);

```

}  
}

---

<div class="post-metadata">

**Author:** ![samme](https://yyz2.discourse-cdn.com/free1/user_avatar/phaser.discourse.group/samme/32/5275_2.png) [@samme](https://phaser.discourse.group/u/samme)\
**Post date:** [March 22, 2019, 11:45pm UTC](https://phaser.discourse.group/t/how-would-i-implement-2-physics-engines-with-scene-management/1789/5 "2019-03-22T23:45:41Z")

</div>

[https://labs.phaser.io/edit.html?src=src\physics\multi\arcade%20and%20matter.js](https://labs.phaser.io/edit.html?src=src%5Cphysics%5Cmulti%5Carcade%20and%20matter.js)

---

<div class="post-metadata">

**Author:** ![Faizan\_Ali](https://yyz2.discourse-cdn.com/free1/user_avatar/phaser.discourse.group/faizan_ali/32/964_2.png) [@Faizan\_Ali](https://phaser.discourse.group/u/Faizan_Ali)\
**Post date:** [March 22, 2019, 11:47pm UTC](https://phaser.discourse.group/t/how-would-i-implement-2-physics-engines-with-scene-management/1789/6 "2019-03-22T23:47:30Z")

</div>

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.

---

<div class="post-metadata">

**Author:** ![Faizan\_Ali](https://yyz2.discourse-cdn.com/free1/user_avatar/phaser.discourse.group/faizan_ali/32/964_2.png) [@Faizan\_Ali](https://phaser.discourse.group/u/Faizan_Ali)\
**Post date:** [March 22, 2019, 11:50pm UTC](https://phaser.discourse.group/t/how-would-i-implement-2-physics-engines-with-scene-management/1789/7 "2019-03-22T23:50:06Z")

</div>

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

[[Album] Imgur ![](https://global.discourse-cdn.com/free1/uploads/phaser1/original/1X/99dd7a433cdfb435af691575f94c4ddb82ea2722.jpeg "Imgur") ](https://imgur.com/a/c1HOoXP)
