JL-F1
March 6, 2023, 10:39pm
1
I’m trying to use the raycast plugin:
I want to make ALL tiles in a layer tested but the list is too long to list them all in an array:
this is my wall layer, all tile in this should be tested by the ray
const worldLayer = map.createLayer('Walls', tileset, 0, 0)
in this section to define test objects:
this.raycaster.mapGameObjects(this.tilemap, false, {
collisionTiles: [1,2,3] //array of tiles types which can collide with ray
});
is there a way to not list all tiles in ‘collisionTiles ’ and put ‘all’ or ‘non empty’ or !=0 ?
samme
March 6, 2023, 10:44pm
2
Try
const worldLayer = map.createLayer('Walls', tileset, 0, 0)
worldLayer.setCollisionByExclusion(-1);
this.raycaster.mapGameObjects(this.tilemap, false, {
collisionTiles: worldLayer.layer.collideIndexes
});
JL-F1
March 20, 2023, 7:20pm
3
changed:
worldLayer.setCollisionByExclusion(-1)
to the list of my floor tiles and worked
Thanks so much!
I had been using:
worldLayer.setCollisionByProperty({
collides: true
})
and I wonder why
console.log( worldLayer.layer.collideIndexes) returns empty array