How to see 3D collisions on Physics Debug? (SOLVED)

Seeing 3D collision shapes would make debugging a lot easier but even after I turn physics → debug on, I cannot see debug shapes.

I get this warning when debug enabled (WARNING:RENDER: Out of debug vertex data (10000). Increase graphics.max_debug_vertices to avoid this warning.) so I increased it a lot. The warning is gone but still no shape is visible. It works well on 2D, is it possible to use with 3D?

Also, the example of debug on: Physics debug is not playing on slow motion when debugging as the text suggest so it needs a quick fix

1 Like

I tried to work out why this example does not display collision normals and did not succeed.

Also this error message occurs:

ERROR:SCRIPT: example/physics.script:12: Could not find socket 'main' when sending message 'set_time_step' from 'default:/go#script' to 'main:/loader'.
stack traceback:
  [C]:-1: in function post
  example/physics.script:12: in function <example/physics.script:6>

Caused by:

		if self.show_debug then -- <4>
			msg.post("main:/loader", "set_time_step", { factor = 1, mode = 0 })
		else
			msg.post("main:/loader", "set_time_step", { factor = 0.1, mode = 1 })
		end

The manual says that this should be posted to a loaded proxy; what is this if a proxy is not loaded, “default:/stuff_dunno”? I am confused, probably missing something obvious, I think the solution is to mow the lawn.

edit0: The normals are drawn, but only when the collision object stops moving for long enough, and this does not happen in the example, add friction to fix. Also the arrows are hard to see because of the colour used.

3 Likes

I added to static boxes to match the wall and floor of the Character example and turned on physics debug:

So we know that it works in the simple case. Did you perhaps modify the render script and remove or change the code which draws debug lines?

4 Likes

Yeah, I had a custom weapon on top script so weapon would not clip through walls and I somehow deleted the render.draw_debug3d() line..

Adding it solved the problem. Thank you for the tip. I will need to be more careful with custom render scripts and materials :sweat_smile:

5 Likes

Thank you!

I created an issue to check it:

2 Likes

PR is up:

https://github.com/defold/examples/pull/136


Edit: Now merged and online: Physics debug

1 Like