Possible to get the dimensions of a collision box? (in runtime)

Hey guys

Is there a way to get the height/width of a collision box in runtime?

(I’d like to draw a debug rectangle based on the collision box in order to make sure the gameplay works as intended)

Thanks :slight_smile:

edit : if not possible, I know I can achieve a similar result by manually copying the height/width, but… not super clean, and a bit more difficult to maintain (if I have multiple collision boxes that I want to tweak there and there) :thinking:

Defold does this for you when you check the “Debug” checkbox in game.project:

image

7 Likes

Interesting, thanks!! :+1:

edit: this is pretty cool but not exactly what I had in mind (even though I just used it to find 1 new issue in my gameplay). I suppose that what I described in my first message is not possible?

No, there is no way to get the size of a collection shape

1 Like

Ok thank you for the confirmation!
I ended up drawing my collision shapes in runtime (thanks to the debugdraw extension), it works pretty well after all.

1 Like