Custom Collision Weirdness With PhysicsEditor

2»

Comments

  • Braydon_SFXBraydon_SFX Member, Sous Chef, PRO, Bowlboy Sidekick Posts: 9,271

    Not sure how that is causing my issue as @Armelline is using the editor in using.

  • tmanntmann Member Posts: 278

    @Braydon_SFX have you tried editing the polygon manually or limiting the vertex count to six ? I have found the auto shaping of Physics Editor to be highly variable and I think the close cropped edges (with alpha) is maybe making it work hard.

    @AlchimiaStudios Physics editor works with multiple polygons too - which you need for complex collision shapes.

  • ArmellineArmelline Member, PRO Posts: 5,332

    @Braydon_SFX I'll upload a video shortly of what I did to get the shape. I can't see why yours isn't working specifically, but I definitely did something different.

    @crestwoodgames Can you post the image you used? I've created similar shapes successfully.

  • Braydon_SFXBraydon_SFX Member, Sous Chef, PRO, Bowlboy Sidekick Posts: 9,271

    @Armelline - awesome, thanks!

    I think @crestwoodgames means that he can't touch and register a touch on his custom collisions. That's something that isn't supported yet and is what my demo was going to do: show a workaround.

  • ArmellineArmelline Member, PRO Posts: 5,332

    I'll be deleting the video in half an hour or so.

  • ArmellineArmelline Member, PRO Posts: 5,332

    @Braydon_SFX said:
    I think @crestwoodgames means that he can't touch and register a touch on his custom collisions. That's something that isn't supported yet and is what my demo was going to do: show a workaround.

    Ah, that makes sense!

  • AlchimiaStudiosAlchimiaStudios Member Posts: 1,069
    edited December 2015

    @tmann said:
    @Braydon_SFX have you tried editing the polygon manually or limiting the vertex count to six ? I have found the auto shaping of Physics Editor to be highly variable and I think the close cropped edges (with alpha) is maybe making it work hard.

    @AlchimiaStudios Physics editor works with multiple polygons too - which you need for complex collision shapes.

    Of course you need them for complex shapes. I couldn't ever get physics editor data to work in GS with more than one poly. Always had errors.

    Follow us: Twitter - Website

  • Braydon_SFXBraydon_SFX Member, Sous Chef, PRO, Bowlboy Sidekick Posts: 9,271

    @Armelline said:

    I'll be deleting the video in half an hour or so.

    I have no idea what I'm doing wrong. I'm still having the issue.
    Perhaps I just need to restart - I'll remove everything off of my Mac and download the tool and the GS file for the tool. Maybe I did something while setting up the tool.

  • ArmellineArmelline Member, PRO Posts: 5,332

    @Braydon_SFX You did a few things differently to me - picked the exporter first, had the extra vertexes - but I really cannot see why either of those things would have any effect on the end result. It's very strange!

  • Braydon_SFXBraydon_SFX Member, Sous Chef, PRO, Bowlboy Sidekick Posts: 9,271

    @Armelline said:
    @Braydon_SFX You did a few things differently to me - picked the exporter first, had the extra vertexes - but I really cannot see why either of those things would have any effect on the end result. It's very strange!

    When I tried your way I picked the exporter after creating the vertexes. Yes, it is very strange. After I set up everything again I'll report back. I hope it's just something I did while setting up the files. We'll see.

  • stevejstevej Member, PRO, Chef Emeritus Posts: 435

    @Braydon_SFX said:
    Hey everyone,

    I finally upgraded to PhysicsEditor this week - I was using the free software before. While the paid application is nice to use, I'm experiencing some odd issues when I import the data into GameSalad. I never had this issue with the free software.

    I've recorded a brief 2 minute video explaining the issue. Maybe others have had this issue and I just missed the comment? Any thoughts or suggestions on how to fix this?

    As always, much appreciated!

    Given your object is spherical, it appears that a rectangular collision body is being applied, otherwise I'd expect some sort of wobble in the shape. So either the vertex data is wrong or the collision shape didn't get added to your actor correctly. Not sure which it is without looking at the data.

  • AlchimiaStudiosAlchimiaStudios Member Posts: 1,069

    So @tmann do you have a project showing multipolygonal shapes made with Physics Editor working in GS?

    Literally every time I try this it says invalid json data. If I delete the additional poly it works just fine.

    (Note: As I said before I'm talking about how PE references polygons, as in the button labeled "add polygon". Not the underlying mesh creating polys between verts in one single unbroken "shape".)

    Follow us: Twitter - Website

  • AlchimiaStudiosAlchimiaStudios Member Posts: 1,069

    @stevej Does what I describe sound like the intended behaviour for shapes from Physics Editor? Is the add polygon button making the "holes" described in the documentation and causing issues, or is this something on my end.

    Follow us: Twitter - Website

  • Braydon_SFXBraydon_SFX Member, Sous Chef, PRO, Bowlboy Sidekick Posts: 9,271

    @stevej said:

    @Braydon_SFX said:
    Hey everyone,

    I finally upgraded to PhysicsEditor this week - I was using the free software before. While the paid application is nice to use, I'm experiencing some odd issues when I import the data into GameSalad. I never had this issue with the free software.

    I've recorded a brief 2 minute video explaining the issue. Maybe others have had this issue and I just missed the comment? Any thoughts or suggestions on how to fix this?

    As always, much appreciated!

    Given your object is spherical, it appears that a rectangular collision body is being applied, otherwise I'd expect some sort of wobble in the shape. So either the vertex data is wrong or the collision shape didn't get added to your actor correctly. Not sure which it is without looking at the data.

    Are you able to get the info from the project file i attached on the previous page?

  • tmanntmann Member Posts: 278

    @Braydon_SFX Armelline had his transparency threshold set at 100 so Physics editor is cropping up to 100.

    @AlchimiaStudios see what you mean now - PBE happily exports data that includes separate remote collision areas ( 'Islands' ? )- Just going to see if I can get PE to do the same .

  • Braydon_SFXBraydon_SFX Member, Sous Chef, PRO, Bowlboy Sidekick Posts: 9,271

    @tmann after watching his video I did set the threshold to 100%. Still getting the error.

  • tmanntmann Member Posts: 278
    edited December 2015

    how many vertices in the export? can you post the data file

  • tmanntmann Member Posts: 278
    edited December 2015

    @AlchimiaStudios the json form PE is missing a comma ! ( , ) more details in a while

  • tmanntmann Member Posts: 278

    @AlchimiaStudios e.g.

    -----------------Invalid JSON data as exported by PE-------------------

    {
    "rigidBodies": [
    {
    "normalized":false,
    "rescale":false,
    "origin":{"x":0,"y":0},
    "size":{"width":120,"height":104},
    "polygons": [
    [
    {"x": 1, "y": 50 },
    {"x": 28, "y": 0 },
    {"x": 92, "y": 0 },
    {"x": 120, "y": 49 },
    {"x": 91, "y": 51 }
    ],
    [
    {"x": 92, "y": 104 },
    {"x": 91, "y": 51 },
    {"x": 120, "y": 49 }
    ] <3 (comma missing)
    [
    {"x": 45, "y": 102 },
    {"x": 5, "y": 102 },
    {"x": 5, "y": 62 }
    ] <3 (comma missing)
    [
    {"x": 69, "y": 83 },
    {"x": 48, "y": 83 },
    {"x": 48, "y": 64 }
    ]
    ]
    }
    ]
    }

    ------------------Valid JSON ------------------------

    {
    "rigidBodies": [
    {
    "normalized":false,
    "rescale":false,
    "origin":{"x":0,"y":0},
    "size":{"width":120,"height":104},
    "polygons": [
    [
    {"x": 1, "y": 50 },
    {"x": 28, "y": 0 },
    {"x": 92, "y": 0 },
    {"x": 120, "y": 49 },
    {"x": 91, "y": 51 }
    ],
    [
    {"x": 92, "y": 104 },
    {"x": 91, "y": 51 },
    {"x": 120, "y": 49 }
    ],
    [
    {"x": 45, "y": 102 },
    {"x": 5, "y": 102 },
    {"x": 5, "y": 62 }
    ],
    [
    {"x": 69, "y": 83 },
    {"x": 48, "y": 83 },
    {"x": 48, "y": 64 }
    ]
    ]
    }
    ]
    }


    the valid JSON has commas between ALL polygon elements

  • tmanntmann Member Posts: 278

    @AlchimiaStudios

    Pretty sure a tiny modification (add a comma : ) ) is needed to the GS exporter plugin but it will have to wait till the morrow as I'm a European

  • AlchimiaStudiosAlchimiaStudios Member Posts: 1,069

    @tmann said:
    @AlchimiaStudios

    Pretty sure a tiny modification (add a comma : ) ) is needed to the GS exporter plugin but it will have to wait till the morrow as I'm a European

    Nice, will try making those changes.

    Follow us: Twitter - Website

  • AlchimiaStudiosAlchimiaStudios Member Posts: 1,069
    edited December 2015

    Yep @tmann looks like a minor error with the exporter. Put commas in correct place and all is well. Thanks

    Follow us: Twitter - Website

  • ArmellineArmelline Member, PRO Posts: 5,332

    @Braydon_SFX GameSalad released two versions of the exporter plugin. Did you grab it when they first released it, or did you grab the updated version? Perhaps that would explain the difference between your results and mine?

  • AlchimiaStudiosAlchimiaStudios Member Posts: 1,069

    Sorry to hijack this thread but I found out the direct cause of the issue in the plugin. In the gamesalad.json file in the plugin folder the code is currently like this.

    { "rigidBodies": [{% for body in bodies %} { "normalized":false, "rescale":false, "origin":{"x":{{body.anchorPointAbs.x}},"y":{{body.anchorPointAbs.y}}}, "size":{"width":{{body.size.width}},"height":{{body.size.height}}}, "polygons": [{% for fixture in body.fixtures %}{% for polygon in fixture.polygons %} [{% for point in polygon %} {"x": {{point.x}}, "y": {{point.y}} }{% if not forloop.last %},{% endif %}{% endfor %} ]{% if not forloop.last %},{% endif %}{% endfor %}{% endfor %} ] }{% if not forloop.last %},{% endif %}{% endfor %} ] }

    When it should be like this:

    { 
        "rigidBodies": [{% for body in bodies %}
        { 
            "normalized":false,
            "rescale":false,
            "origin":{"x":{{body.anchorPointAbs.x}},"y":{{body.anchorPointAbs.y}}},
            "size":{"width":{{body.size.width}},"height":{{body.size.height}}},
        "polygons": [{% for fixture in body.fixtures %}{% for polygon in fixture.polygons %}
                [{% for point in polygon %}
                    {"x": {{point.x}}, "y": {{point.y}} }{% if not forloop.last %},{% endif %}{% endfor %} 
                ],{% if not forloop.last %},{% endif %}{% endfor %}{% endfor %}
            ]
    
        }{% if not forloop.last %},{% endif %}{% endfor %}
        ]
    }
    

    It was missing a "," in the rules. So that's why json errors are occuring for multpolygonal objects exported from Physics Editor. @tmann

    @CodeWizard @stevej @QASalad might want to update the plugin.

    Follow us: Twitter - Website

  • tmanntmann Member Posts: 278

    interesting :) my solution was this

    {
    "rigidBodies": [{% for body in bodies %}
    {
    "normalized":false,
    "rescale":false,
    "origin":{"x":{{body.anchorPointAbs.x}},"y":{{body.anchorPointAbs.y}}},
    "size":{"width":{{body.size.width}},"height":{{body.size.height}}},
    "polygons": [{% for fixture in body.fixtures %}{% for polygon in fixture.polygons %}
    [{% for point in polygon %}
    {"x": {{point.x}}, "y": {{point.y}} }{% if not forloop.last %},{% endif %}{% endfor %}
    ]{% if not forloop.last %},{% endif %}{% endfor %}, <3 {% endfor %}
    ]
    }{% if not forloop.last %},{% endif %}{% endfor %}
    ]
    }

    which seemed to work

  • The_Gamesalad_GuruThe_Gamesalad_Guru Member Posts: 9,922

    Mine works fine without import error as is. If I put the comma in it says invalid. I have having issues with collides.

  • Braydon_SFXBraydon_SFX Member, Sous Chef, PRO, Bowlboy Sidekick Posts: 9,271

    @Lost_Oasis_Games @Armelline @stevej

    Update guys:
    I resolved the issue. Turns out I needed to download the required plugin again and create a new directory inside PhysicsEditor.
    I assume there was an issue with the plugin I downloaded when the feature was initially released and I must have missed the update.

    Thanks for your help!

  • stevejstevej Member, PRO, Chef Emeritus Posts: 435

    @AlchimiaStudios said:
    Sorry to hijack this thread but I found out the direct cause of the issue in the plugin. In the gamesalad.json file in the plugin folder the code is currently like this.

    { "rigidBodies": [{% for body in bodies %} { "normalized":false, "rescale":false, "origin":{"x":{{body.anchorPointAbs.x}},"y":{{body.anchorPointAbs.y}}}, "size":{"width":{{body.size.width}},"height":{{body.size.height}}}, "polygons": [{% for fixture in body.fixtures %}{% for polygon in fixture.polygons %} [{% for point in polygon %} {"x": {{point.x}}, "y": {{point.y}} }{% if not forloop.last %},{% endif %}{% endfor %} ]{% if not forloop.last %},{% endif %}{% endfor %}{% endfor %} ] }{% if not forloop.last %},{% endif %}{% endfor %} ] }

    When it should be like this:

    { 
      "rigidBodies": [{% for body in bodies %}
      { 
          "normalized":false,
          "rescale":false,
          "origin":{"x":{{body.anchorPointAbs.x}},"y":{{body.anchorPointAbs.y}}},
          "size":{"width":{{body.size.width}},"height":{{body.size.height}}},
      "polygons": [{% for fixture in body.fixtures %}{% for polygon in fixture.polygons %}
              [{% for point in polygon %}
                  {"x": {{point.x}}, "y": {{point.y}} }{% if not forloop.last %},{% endif %}{% endfor %} 
              ],{% if not forloop.last %},{% endif %}{% endfor %}{% endfor %}
          ]
          
      }{% if not forloop.last %},{% endif %}{% endfor %}
      ]
    }
    

    It was missing a "," in the rules. So that's why json errors are occuring for multpolygonal objects exported from Physics Editor. @tmann

    @CodeWizard @stevej @QASalad might want to update the plugin.

    Hmm, your change should put a "," at the end of every block, including the last one, which shouldn't have one. The "if not forloop.last" tag should cause a comma to be put at the end of every block except the last one.

  • AlchimiaStudiosAlchimiaStudios Member Posts: 1,069

    @stevej I never get errors or odd behavior with the "," at the end of every block. But I do get errors with the default plugin because after the first poly block with multi-polygonal data it starts to leave out a "," at the end which causes a json error on import for me.

    Collisions appear to work fine wirth every block having a "," . Is there a reason this isn't suggested?

    Follow us: Twitter - Website

  • stevejstevej Member, PRO, Chef Emeritus Posts: 435

    @AlchimiaStudios said:
    @stevej I never get errors or odd behavior with the "," at the end of every block. But I do get errors with the default plugin because after the first poly block with multi-polygonal data it starts to leave out a "," at the end which causes a json error on import for me.

    Collisions appear to work fine wirth every block having a "," . Is there a reason this isn't suggested?

    Technically it's not good JSON data. If it works, it's just because the JSON parser is ignoring it (we're using Apple's parser on Mac and the Newtonsoft parser on WIndows).

Sign In or Register to comment.