Tool for drawing collision boxes?

Tool for drawing collision boxes?

Postby Sauer2 » 04 Aug 2016, 13:49

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
User avatar
Sauer2
 
Posts: 430
Joined: 19 Jan 2010, 14:02

Re: Tool for drawing collision boxes?

Postby Julius » 04 Aug 2016, 16:34

Hmm, as in 2D sprites? Maybe that's part of those pixel sprite drawing applications?
User avatar
Julius
Community Moderator
 
Posts: 3297
Joined: 06 Dec 2009, 14:02

Re: Tool for drawing collision boxes?

Postby Sauer2 » 04 Aug 2016, 16:56

>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.
User avatar
Sauer2
 
Posts: 430
Joined: 19 Jan 2010, 14:02

Re: Tool for drawing collision boxes?

Postby c_xong » 05 Aug 2016, 07:54

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.
User avatar
c_xong
 
Posts: 234
Joined: 06 Sep 2013, 04:33

Re: Tool for drawing collision boxes?

Postby NaN » 05 Aug 2016, 09:11

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" .../>
NaN
 
Posts: 151
Joined: 18 Jan 2010, 10:32

Re: Tool for drawing collision boxes?

Postby Sauer2 » 07 Aug 2016, 14:20

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...
User avatar
Sauer2
 
Posts: 430
Joined: 19 Jan 2010, 14:02

Who is online

Users browsing this forum: No registered users and 1 guest

cron