Page 1 of 1

Tool for drawing collision boxes?

PostPosted: 04 Aug 2016, 13:49
by Sauer2
Hi there,

do standalone (outside of engine SDKs) tools exist that let one open an image file, let one draw a couple of collision rectangles and save them as text file? I have trouble even finding something like this by searching, as results seem to be either related to geospatial boundary boxes or shady game dev tutorials.

What is that class of software even called? Or are they mostly part of animation packages?

thanks in advance

Re: Tool for drawing collision boxes?

PostPosted: 04 Aug 2016, 16:34
by Julius
Hmm, as in 2D sprites? Maybe that's part of those pixel sprite drawing applications?

Re: Tool for drawing collision boxes?

PostPosted: 04 Aug 2016, 16:56
by Sauer2
>Hmm, as in 2D sprites?
Yes.
>Maybe that's part of those pixel sprite drawing applications?
I don't know. But it would make sense, especially when combined with sprite sheet/atlas creation.

Re: Tool for drawing collision boxes?

PostPosted: 05 Aug 2016, 07:54
by c_xong
Closest thing I've found is https://www.codeandweb.com/physicseditor (unfortunately not free), which is a general purpose editor for creating 2D collision shapes for use in various game engines. It even lets you edit common properties like elasticity and friction.

It has many export formats but one is JSON which looks like this:

{l Code}: {l Select All Code}
{
    "betty": [
        {
            "shape": [ 1, 63 , 8, 54 , 11, 63 , 2, 73 ]
        } ,
        {
            "shape": [ 67, 56 , 54, 64 , 57, 56 , 67, 51 ]
        } ,
       ...


Presumably those integers are ids for the actual vertices. Depending on what your engine/game is expecting, it's pretty easy to parse something like that.

Since you mention rectangles, it seems your engine/game is using AABB collision, where this format isn't ideal, as you'd want just pairs of x/y coordinates describing those rectangles. Unfortunately there doesn't seem to be a general purpose tool for that. The format itself should be very simple; the hard part - as in tedious - is making a GUI editor. Maybe the easiest solution is to simply load your image in an editor, and manually transcribe the coordinates? Yes this sounds crap but it will probably save you a lot of time overall unless you are doing this hundreds of times.

Re: Tool for drawing collision boxes?

PostPosted: 05 Aug 2016, 09:11
by NaN
A vector graphics editor (Inkscape) maybe?

Draw rectangles export as svg, would look like this:
{l Code}: {l Select All Code}
<rect x="50" y="20" width="150" height="150" .../>

Re: Tool for drawing collision boxes?

PostPosted: 07 Aug 2016, 14:20
by Sauer2
Inkscape could be a good software for it, but I think the actual handling is still tedious if one wanted to combine this with multiple files.
It's not even that hard to do by hand as long as it isn't masses of images as c_xong said.
I rather wanted to know if standards or conventions for the workflow or file formats exist because I'm pondering about building such a tool to get experience with Qt...