# Debug render ignoring camera position

**URL:** <https://forum.defold.com/t/debug-render-ignoring-camera-position/72101>\
**Category:** Questions\
**Created:** [November 19, 2022, 4:18pm UTC](https://forum.defold.com/t/debug-render-ignoring-camera-position/72101 "2022-11-19T16:18:08Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![Wistpotion](https://forum-defold.b-cdn.net/user_avatar/forum.defold.com/wistpotion/32/29771_2.png) [@Wistpotion](https://forum.defold.com/u/Wistpotion)\
**Post date:** [November 19, 2022, 4:18pm UTC](https://forum.defold.com/t/debug-render-ignoring-camera-position/72101/1 "2022-11-19T16:18:08Z")

</div>

I’m using the fantastic debug-draw library and the really quite splendid rendercam. Problem is I just combined them together, and they are not really cooperating. Anything drawn with messages to @render just ignores the offset that the camera should cause, resulting in the debug text being completely static on screen while the world moves around from the camera movement.

My solution is to use rendercams internal functions to convert screen to world space, and then use that position to draw. It works, it’s not very neat however, as it requires the use of rendercam. Now, is there a way to make draw\_debug3d() to render in world space, or a way to get the current viewport / transform of the renderer? Also I have no clue what I’m doing right now, I know quite little about rendering in general, so any advice here is super appreciated :3

---

<div class="post-metadata">

**Author:** ![Wistpotion](https://forum-defold.b-cdn.net/user_avatar/forum.defold.com/wistpotion/32/29771_2.png) [@Wistpotion](https://forum.defold.com/u/Wistpotion)\
**Post date:** [November 19, 2022, 4:45pm UTC](https://forum.defold.com/t/debug-render-ignoring-camera-position/72101/2 "2022-11-19T16:45:13Z")

</div>

Actually, I discovered this only applies to text, the lines work just fine.

---

<div class="post-metadata">

**Author:** ![ross.grams](https://forum-defold.b-cdn.net/letter_avatar_proxy/v4/letter/r/cab0a1/32.png) [@ross.grams](https://forum.defold.com/u/ross.grams)\
**Post date:** [November 20, 2022, 1:10pm UTC](https://forum.defold.com/t/debug-render-ignoring-camera-position/72101/3 "2022-11-20T13:10:15Z")

</div>

This _is_ mentioned in the debug-draw readme for [debugdraw.text()](https://github.com/rgrams/debug-draw#debugdrawtexttext-x-y-color). Debug text is _not_ drawn with draw\_debug3d(), it is drawn separately with the “text” predicate. If you want to render debug text in world space, then you can edit your render script update(). In the built-in one, move this line:

```lua
render.draw(self.text_pred, {frustum = frustum_gui})

```

…up to where the tile predicate and particle predicate are drawn (and probably switch the frustum to match the one those use).

---

<div class="post-metadata">

**Author:** ![Wistpotion](https://forum-defold.b-cdn.net/user_avatar/forum.defold.com/wistpotion/32/29771_2.png) [@Wistpotion](https://forum.defold.com/u/Wistpotion)\
**Post date:** [November 20, 2022, 4:25pm UTC](https://forum.defold.com/t/debug-render-ignoring-camera-position/72101/4 "2022-11-20T16:25:49Z")

</div>

I totally missed that. Thanks a ton! I’ll get better at reading the documentation.
