kidscancode / godot_recipes

Lessons, tutorials, and guides for game development using the Godot game engine.
MIT License
235 stars 38 forks source link

[Discussion] Drawing vectors in 3D #37

Open cbscribe opened 3 years ago

cbscribe commented 3 years ago

Discussion for http://godotrecipes.com/3d/debug_overlay/

MarkusTieche commented 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 :)

cbscribe commented 3 years ago

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.

enbugger commented 2 years ago

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

kapeeteeleest-peeg commented 2 years ago

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

rubenmoor commented 2 years ago
    func _process(_delta):
        if not visible:
            return
        # more code here ...

this seems like bad practice. There are these functions for this purpose:

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

a-k-m123 commented 2 years ago

and corresponding scripts attachments.

Could you get this to run? I don't know how to set it up from the snippets....