# Collisions not detected

**URL:** <https://phaser.discourse.group/t/collisions-not-detected/5114>\
**Category:** Phaser 3\
**Created:** [February 9, 2020, 4:41pm UTC](https://phaser.discourse.group/t/collisions-not-detected/5114 "2020-02-09T16:41:43Z")\
**Posts on this page:** 5\
**Page:** 1

<div class="post-metadata">

**Author:** ![YakusActual](https://yyz2.discourse-cdn.com/free1/user_avatar/phaser.discourse.group/yakusactual/32/2568_2.png) [@YakusActual](https://phaser.discourse.group/u/YakusActual)\
**Post date:** [February 9, 2020, 4:41pm UTC](https://phaser.discourse.group/t/collisions-not-detected/5114/1 "2020-02-09T16:41:43Z")

</div>

Hi All!

Im currently building a dungeon crawler, and my character is not colliding wit the walls.  
Everything is made up of tiles, all wals are added to the physics group, and also I’m creating the player as a physics object.

This is how I setup everything:

```
create () {

this.walls = this.physics.add.staticGroup();

this.map = new MapGenerator(this.width, this.height, 20, 10, 10, 60);

this.asciiMap = this.map.getMap();
this.displayMapOnCanvas(this.asciiMap);

this.player = this.physics.add.sprite(this.playerSpawn.spawnX, this.playerSpawn.spawnY, 'hero');
this.player.setBounce(0.2);

this.physics.add.collider(this.game, false, this.player, this.walls);

this.cameras.main.setBounds(0, 0, this.game.width, this.game.height);
this.cameras.main.startFollow(this.player);

this.cursors = this.input.keyboard.createCursorKeys();

```

}

And this is how I draw the map with the walls:

```
displayMapOnCanvas(asciiMap) {
var wallPhysics = null;
var sprite = null;
var image = null;
var playerX = null;
var playerY = null;

for(var y = 0; y < this.height; y++){
  for (var x = 0; x < this.width; x++){
    switch(asciiMap[y][x].pointFace){
      case '#': sprite = 'tile-stone';
      break;
      case ' ': sprite = 'tile-ground';
      break;
      case 'D': sprite = 'tile-door';
      break;
      case 'H': sprite = 'tile-path';
      break;
      case 'X': sprite = 'tile-marker';
      break;
      case '+': sprite = 'tile-wall';
      break;
      case '@': sprite = 'player';
      break;
      default: sprite = 'tile-ground';
    }

    if (sprite == 'tile-wall') {
      wallPhysics = this.physics.add.sprite(x*32, y*32, sprite);
      wallPhysics.setOrigin(0, 0);
      this.walls.add(wallPhysics);
    } else if (sprite == 'player'){
      image = this.add.image(x*32, y*32, 'tile-ground');
      image.setOrigin(0, 0);
      this.playerSpawn = {spawnX: (x * 32) + 16, spawnY: (y * 32) + 16};
    } else {
      image = this.add.image(x*32, y*32, sprite);
      image.setOrigin(0, 0);
    }
  }
}

```

}

The collisions are not being detected at all.

Thank you for all the help!

---

<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:** [February 9, 2020, 4:52pm UTC](https://phaser.discourse.group/t/collisions-not-detected/5114/2 "2020-02-09T16:52:35Z")

</div>

Should be

```javascript
this.physics.add.collider(this.player, this.walls);

```

---

<div class="post-metadata">

**Author:** ![YakusActual](https://yyz2.discourse-cdn.com/free1/user_avatar/phaser.discourse.group/yakusactual/32/2568_2.png) [@YakusActual](https://phaser.discourse.group/u/YakusActual)\
**Post date:** [February 9, 2020, 5:31pm UTC](https://phaser.discourse.group/t/collisions-not-detected/5114/3 "2020-02-09T17:31:42Z")

</div>

Hey, this doesn’t work either, I had that line initially, as I followed the [tutorial](https://phaser.io/tutorials/making-your-first-phaser-3-game/part6).

My gut is telling me that I might be using wrong physics system (currently using Arcade)

You can see how it all currently works in [here](http://wordphasergame.orgfree.com)

---

<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:** [February 9, 2020, 5:51pm UTC](https://phaser.discourse.group/t/collisions-not-detected/5114/4 "2020-02-09T17:51:03Z")

</div>

Turn on physics debug.

---

<div class="post-metadata">

**Author:** ![YakusActual](https://yyz2.discourse-cdn.com/free1/user_avatar/phaser.discourse.group/yakusactual/32/2568_2.png) [@YakusActual](https://phaser.discourse.group/u/YakusActual)\
**Post date:** [February 9, 2020, 6:02pm UTC](https://phaser.discourse.group/t/collisions-not-detected/5114/5 "2020-02-09T18:02:33Z")

</div>

Nevermind I was being very dumb, and instead of: `wallPhysics = this.walls.create()` I just pushed an object into the group, so it never registered it as a physics object properly.
