Phaser-raycaster not mapping all tiles in updated tileset

Hi all,

I’m working on a game that heavily relies on the Phaser-raycaster plugin to perform “bullet” vs tile “destruction.”

The way this works is during a “shooting loop” I’ll cast a ray from roughly the tip of my character’s gun to the nearest tile intersection. The colliding tiles index will be checked, and moved along to it’s next stage of destruction (just another tile, but more broken), see screenshot of tileset below to get a feel for what I mean.

The thing is, since introducing the new tiles (the purple brick ones), the raycasting plugin is ignoring the later stages of each tile’s destruction, enabling the player to just shoot straight through them with no effect. To see this in action check out this clip:

As the game is open source, here are a couple links to relevant lines of code:

If anyone has experience with the plugin and has any thoughts as to what’s going on please do let me know, I’m really struggling with this one!

:pray:

Hi,
Try with
this.ground.putTileAt(11, tile.x, tile.y, true).setCollision(true, true, true, true, true)

Hey @BlunT76 I gave it a try (applied to all calls to this.ground.putTileAt in GameScene2::damageTile) but unfortunately the issue persists.

I think the issue is rooted in the raycaster plugin, not the Phaser colliders :cry:

Did you mean you modified the tileset png? if yes, perhaps the index are wrong now

I did modify the tileset, but I’ve also updated the indexes which should be being mapped by the raycaster. You can see this here:

What I’m not understanding is why tiles >= 21 are being ignored by the raycaster plugin.

Got it, turned out the issue was just that I was calling mapGameObjects too early in the process. Calling it after the map was completely created (logically) worked bang on :slight_smile:

I tried this and I think the problem was calling mapGameObjects() on the same game object (tilemap layer) multiple times, with different collision tile indexes. The plugin keeps only one vertex/segment map per game object, even if you’ve created multiple raycasters, so only the last call would be effective. You can see the map with

gameObject.getData('raycasterMap')