wiserim / phaser-raycaster

Raycasting plugin for Phaser 3. Documentation:

Home Page:https://wiserim.github.io/phaser-raycaster/

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Plugin should destroy debug graphics of raycasts that get destroyed.

CodestarGames opened this issue · comments

As far as I can tell, rays, raycasters, and maps can be destroyed now, but the debug graphics that they use still remain in the scene after they are destroyed.

image

Hello,
Thank you for reporting this bug.

Turns out Ray.destroy() method doesn't destroy graphics object it's using to draw in debug mode.
The same goes to Raycaster.destroy().

I've started working on major update for plugin, but I should be able to deliver bug fixes soon.

I've published version 0.10.6.
It includes fixes for reported bugs.

Thanks! That fix removed the debug graphics upon the destroy method being called. Although, I'm also using the debug flag in arcade physics to show the bodies and it seems the physics bodies don't get removed unless I remove them manually myself before I call the destroy method on rays.

Raycaster doesn't destroy any game objects or physics bodies.
It only destroys Raycaster.Map objects assigned to them.

Docs: Raycaster.removeMappedObjects()
Codepen Example