Estoy creando un juego de disparos en Phaser 3, y me pregunto si hay una manera de lanzar un rayo desde un objeto del juego en una dirección usando un ángulo o dos pares de coordenadas, ¿tal vez así?
this.ray = this.physics.add.ray(this.player.x, this.player.y, this.pointer.worldX, this.pointer.worldY); this.physics.add.collider(this.ray, this.someEnemy, () => { alert("you hit something!") })o tal vez así?
this.ray = this.physics.add.ray(this.player.x, this.player.y, Phaser.Math.RAD_TO_DEG * Phaser.Math.Angle.Between(this.player.x, this.player.y, pointer.worldX, pointer.worldY);) this.physics.add.collider(this.ray, this.someEnemy, () => { alert("you hit something!") })