Render debug info for this object
()
| 533 | |
| 534 | /** Render debug info for this object */ |
| 535 | renderDebugInfo() |
| 536 | { |
| 537 | if (!debug) return; |
| 538 | |
| 539 | // check if there is anything to show |
| 540 | const hasPhysics = this.collideTiles || this.collideSolidObjects || this.isSolid; |
| 541 | if (!hasPhysics && !this.parent) return; |
| 542 | |
| 543 | // show object info for debugging |
| 544 | const size = vec2(max(this.size.x, .2), max(this.size.y, .2)); |
| 545 | const color = rgb(this.collideTiles?1:0, this.collideSolidObjects?1:0, this.isSolid?1:0, .5); |
| 546 | debugRect(this.pos, size, color, 0, this.angle, hasPhysics); |
| 547 | if (this.parent) |
| 548 | debugRect(this.pos, size.scale(.8), rgb(1,1,1,.5), 0, this.angle); |
| 549 | this.parent && debugLine(this.pos, this.parent.pos, rgb(1,1,1,.5), .5); |
| 550 | } |
| 551 | } |