MZ [SOLVED]Stuck trying to graw a graphic on screen for debugging

I am building a plugin that handles NPC vision and player detection for MZ and while I was able to get some basic things working like tying visions to NPC looking direction and following the player when spotted, I am trying to debug where the vision shows on screen and the actual hit box vertices (that are generated from a collision detection lib)

I want to draw graphics to the screen to accuratly reflect where the vertices are detected so I can figure out the off set algorithm but I can't seem to figure out how to use pixi to draw graphics properly on the sceen. The problem is, the minute I tie a graphic to a spirte it jacks up the exact location... I need precise debugging display to fix the off set calculations. Any ideas how to draw directly to the scene accuratly would be a huge help for me

Here is the debugCode i've been futzing with that gets called is the NPC sprites update method

drawDebug() { if(this.IR_Vision_debug) { SceneManager._scene._spriteset.removeChild(this.IR_Vision_debug); } let gr = new PIXI.Graphics(); gr.beginFill(0xFF0000); gr.width = 2000; gr.height = 2000; gr.lineStyle(10, 0xFF0000, 1); gr.moveTo(this.shape.AABB[0], this.shape.AABB[1]); gr.lineTo(this.shape.AABB[3], this.shape.AABB[4]); gr.endFill(); let debugBitmap = Graphics.app.renderer.generateTexture(gr); debugBitmap._width = 2000; debugBitmap._height = 2000; gr.destroy(); this.IR_Vision_debug = new PIXI.Sprite(debugBitmap); debugBitmap.addLoadListener = function(listner) { listner(this.IR_Vision_debug); }; SceneManager._scene._spriteset.addChild(this.IR_Vision_debug); }

Update:
I figured it out

createVisionDebugBitmap() { if(this.IR_debug_sprite) { SceneManager._scene._spriteset.removeChild(this.IR_debug_sprite); } let gr = new PIXI.Graphics(); gr.beginFill(0xFF0000); gr.drawRect(0, 0, this.shape.AABB[2] - this.shape.AABB[0], this.shape.AABB[3] - this.shape.AABB[1]); gr.endFill(); let visionBitmap = Graphics.app.renderer.generateTexture(gr); gr.destroy(); visionBitmap.addLoadListener = function(listner) { listner(this); }; this.IR_debug_sprite = new PIXI.Sprite(visionBitmap); this.IR_debug_sprite.opacity = .5; this.IR_debug_sprite.x = this.shape.AABB[0]; this.IR_debug_sprite.y = this.shape.AABB[1]; SceneManager._scene._spriteset.addChild(this.IR_debug_sprite); }

Original thread: https://forums.rpgmakerweb.com/threads/solved-stuck-trying-to-graw-a-graphic-on-screen-for-debugging.134391/