Open cbscribe opened 3 years ago
Great post, thank you. While creating the debug draw node I have noticed some problems.
In the Vector class there is value = _property
but later it is used in the draw function as
camera.unproject_position(object.global_transform.origin + object.get(property) * scale)
causes an error.
Also, I underestimated the importance of the update() function in _process() to clear & update draw positions in the canvas node. Might be a good idea to put more information there? A finished script example to examine or download would be a great addition too.
Anyway, thank you :)
Also, I underestimated the importance of the update() function in _process() to clear & update draw positions in the canvas node.
I should probably do a more basic one just about custom drawing in general.
This tutorial has useful information but it's super hard to understand the structure of the scene and corresponding scripts attachments. I can't compose it from the snippets
Also (To avoid dying a thousand deaths... Like I did!) DebugDraw3d.add_vector(self, "velocity", 1, 4, Color(0,1,0, 0.5)) NOT DebugOverlay.draw.add_vector(self, "velocity", 1, 4, Color(0,1,0, 0.5))
func _process(_delta):
if not visible:
return
# more code here ...
this seems like bad practice. There are these functions for this purpose:
_set_process(false)
to not run _process
_set_physics_process(false)
to not run _physics_process
disabled = true
, e.g. to disable collisionshapesvisible = false
, to hide stuff, keeping the rest intactIf you want to minimize performance impact of the debug layer, it shouldn't be an autoload in the first place as they are meant to be always loaded and active.
and corresponding scripts attachments.
Could you get this to run? I don't know how to set it up from the snippets....
Discussion for http://godotrecipes.com/3d/debug_overlay/