Maybe a draw polygon, and then you specify the number of sides and the radius? Then you also specify to fill or only be outlines. This would help with testing and prototyping. It’s a feature which other engines have better support of, and porting projects to Defold would be helped by adding it.
msg.post("@render:", "draw_polygon", { position = vmath.vector3(200, 200, 0), sides = 3, radius = 42, style = 0, rotation = 0, scale = 1 } )
-- draw a triangle with , 0 for outline only no fill
msg.post("@render:", "draw_convex_shape", { position = vmath.vector3(200, 200, 0), points = { ... }, style = 0, rotation = 0, scale = 1 } )
-- draw a convex hull, position would be based on the center of mass
Hmm, I wonder what would be the best way of achieving something like this? I’m not sure that adding more functions to complement the draw_line and draw_text messages is a good way to go about it. @sven and @Ragnar_Svensson, is this something that has been discussed?
The physics debug graphics are drawn by c++ code, i.e. pretty much hardcoded. I think it would make sense to have something very simplistic supported by default (draw_box, draw_sphere) and then a future extension for more complex things like arbitrary polygons.
I’m afraid not.
Note that these functions are really just for debug features too.
As we do more work on our 3D support though, we’ll need to add support for new vertex formats, and I think at that point we’ll be able to provide a better methods to achieve this.