Debug render ignoring camera position

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

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

1 Like

This is mentioned in the debug-draw readme for debugdraw.text(). 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:

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).

3 Likes

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

2 Likes