GameSalad

Custom collisions question using PhysicsEditor

sinbotsinbot Posts: 57Member, PRO

I'm using PhysicsEditor to make custom collisions. It seems like the program allows me to assign collisions to multiple areas of an actor that are not directly connected but when I try to assign it in GS I receive the invalid prompt. I read some old docs that this is possible. Can anyone confirm if this is the reason for the invalid prompt?

PS When I say custom collisions for an actor that is not completely connected I mean something like this..

Comments

  • BunkerBunker Posts: 36Member, PRO

    {"rigidBodies":[{"name":"Name","imagePath":"wzwjf3ds95ne.png","origin":{"x":0,"y":0},"polygons":[[{"x":0.8475000858306885,"y":1.4824998378753662},{"x":0.8475000858306885,"y":1.4024999141693115},{"x":0.9975000619888306,"y":1.4024999141693115},{"x":0.9975000619888306,"y":1.7724997997283936}],[{"x":0.9975000619888306,"y":1.7724997997283936},{"x":0.6475000381469727,"y":1.552499771118164},{"x":0.6475000381469727,"y":1.4824998378753662},{"x":0.8475000858306885,"y":1.4824998378753662}],[{"x":0.9975000619888306,"y":1.7724997997283936},{"x":0.4624999463558197,"y":1.6374999284744263},{"x":0.4624999463558197,"y":1.552499771118164},{"x":0.6475000381469727,"y":1.552499771118164}],[{"x":0.9975000619888306,"y":1.7724997997283936},{"x":0.2875000536441803,"y":1.7724997997283936},{"x":0.29250001907348633,"y":1.6374999284744263},{"x":0.4624999463558197,"y":1.6374999284744263}],[{"x":0.007500022649765015,"y":0.012500107288360596},{"x":0.09250006079673767,"y":0.007500052452087402},{"x":0.08749997615814209,"y":0.3824999928474426},{"x":0.0025000572204589844,"y":0.3824999928474426}],[{"x":0.6574999690055847,"y":0.05750006437301636},{"x":0.4724999964237213,"y":0.05750006437301636},{"x":0.4825000464916229,"y":0.007500052452087402},{"x":0.9825000762939453,"y":0.0025000572204589844}],[{"x":0.9825000762939453,"y":0.0025000572204589844},{"x":0.8475000858306885,"y":0.12750008702278137},{"x":0.67249995470047,"y":0.12750008702278137},{"x":0.6574999690055847,"y":0.05750006437301636}],[{"x":0.9825000762939453,"y":0.0025000572204589844},{"x":0.9874998927116394,"y":0.2225000262260437},{"x":0.8425000309944153,"y":0.2225000262260437},{"x":0.8475000858306885,"y":0.12750008702278137}]],"circles":[],"shapes":[{"type":"POLYGON","vertices":[{"x":0.9975000619888306,"y":1.7724997997283936},{"x":0.2875000536441803,"y":1.7724997997283936},{"x":0.29250001907348633,"y":1.6374999284744263},{"x":0.4624999463558197,"y":1.6374999284744263},{"x":0.4624999463558197,"y":1.552499771118164},{"x":0.6475000381469727,"y":1.552499771118164},{"x":0.6475000381469727,"y":1.4824998378753662},{"x":0.8475000858306885,"y":1.4824998378753662},{"x":0.8475000858306885,"y":1.4024999141693115},{"x":0.9975000619888306,"y":1.4024999141693115}]},{"type":"POLYGON","vertices":[{"x":0.0025000572204589844,"y":0.3824999928474426},{"x":0.08749997615814209,"y":0.3824999928474426},{"x":0.09250006079673767,"y":0.007500052452087402},{"x":0.007500022649765015,"y":0.012500107288360596}]},{"type":"POLYGON","vertices":[{"x":0.9874998927116394,"y":0.2225000262260437},{"x":0.8425000309944153,"y":0.2225000262260437},{"x":0.8475000858306885,"y":0.12750008702278137},{"x":0.67249995470047,"y":0.12750008702278137},{"x":0.6574999690055847,"y":0.05750006437301636},{"x":0.4724999964237213,"y":0.05750006437301636},{"x":0.4825000464916229,"y":0.007500052452087402},{"x":0.9825000762939453,"y":0.0025000572204589844}]}]}],"dynamicObjects":[]}

    paste into a text file and change to .json then import should work- used physics editor

  • sinbotsinbot Posts: 57Member, PRO

    you just made my brain explode LMAO> @Bunker said:

    {"rigidBodies":[{"name":"Name","imagePath":"wzwjf3ds95ne.png","origin":{"x":0,"y":0},"polygons":[[{"x":0.8475000858306885,"y":1.4824998378753662},{"x":0.8475000858306885,"y":1.4024999141693115},{"x":0.9975000619888306,"y":1.4024999141693115},{"x":0.9975000619888306,"y":1.7724997997283936}],[{"x":0.9975000619888306,"y":1.7724997997283936},{"x":0.6475000381469727,"y":1.552499771118164},{"x":0.6475000381469727,"y":1.4824998378753662},{"x":0.8475000858306885,"y":1.4824998378753662}],[{"x":0.9975000619888306,"y":1.7724997997283936},{"x":0.4624999463558197,"y":1.6374999284744263},{"x":0.4624999463558197,"y":1.552499771118164},{"x":0.6475000381469727,"y":1.552499771118164}],[{"x":0.9975000619888306,"y":1.7724997997283936},{"x":0.2875000536441803,"y":1.7724997997283936},{"x":0.29250001907348633,"y":1.6374999284744263},{"x":0.4624999463558197,"y":1.6374999284744263}],[{"x":0.007500022649765015,"y":0.012500107288360596},{"x":0.09250006079673767,"y":0.007500052452087402},{"x":0.08749997615814209,"y":0.3824999928474426},{"x":0.0025000572204589844,"y":0.3824999928474426}],[{"x":0.6574999690055847,"y":0.05750006437301636},{"x":0.4724999964237213,"y":0.05750006437301636},{"x":0.4825000464916229,"y":0.007500052452087402},{"x":0.9825000762939453,"y":0.0025000572204589844}],[{"x":0.9825000762939453,"y":0.0025000572204589844},{"x":0.8475000858306885,"y":0.12750008702278137},{"x":0.67249995470047,"y":0.12750008702278137},{"x":0.6574999690055847,"y":0.05750006437301636}],[{"x":0.9825000762939453,"y":0.0025000572204589844},{"x":0.9874998927116394,"y":0.2225000262260437},{"x":0.8425000309944153,"y":0.2225000262260437},{"x":0.8475000858306885,"y":0.12750008702278137}]],"circles":[],"shapes":[{"type":"POLYGON","vertices":[{"x":0.9975000619888306,"y":1.7724997997283936},{"x":0.2875000536441803,"y":1.7724997997283936},{"x":0.29250001907348633,"y":1.6374999284744263},{"x":0.4624999463558197,"y":1.6374999284744263},{"x":0.4624999463558197,"y":1.552499771118164},{"x":0.6475000381469727,"y":1.552499771118164},{"x":0.6475000381469727,"y":1.4824998378753662},{"x":0.8475000858306885,"y":1.4824998378753662},{"x":0.8475000858306885,"y":1.4024999141693115},{"x":0.9975000619888306,"y":1.4024999141693115}]},{"type":"POLYGON","vertices":[{"x":0.0025000572204589844,"y":0.3824999928474426},{"x":0.08749997615814209,"y":0.3824999928474426},{"x":0.09250006079673767,"y":0.007500052452087402},{"x":0.007500022649765015,"y":0.012500107288360596}]},{"type":"POLYGON","vertices":[{"x":0.9874998927116394,"y":0.2225000262260437},{"x":0.8425000309944153,"y":0.2225000262260437},{"x":0.8475000858306885,"y":0.12750008702278137},{"x":0.67249995470047,"y":0.12750008702278137},{"x":0.6574999690055847,"y":0.05750006437301636},{"x":0.4724999964237213,"y":0.05750006437301636},{"x":0.4825000464916229,"y":0.007500052452087402},{"x":0.9825000762939453,"y":0.0025000572204589844}]}]}],"dynamicObjects":[]}

    paste into a text file and change to .json then import should work- used physics editor

  • BunkerBunker Posts: 36Member, PRO

    • Physics Body Editor 2.9.2. (Link to download site)
    http://www.aurelienribon.com/post/2012-04-physics-body-editor-pre-3-0-update

    • When you want to make a new collision file - launch Physics Body Editor and follow steps below

    1- Click on “New Project”

    2- Name your file (this is the output file you are going to reference in Gamesalad)
    ** eg: Anything.json, ThatThing.json, TestObject.json **
    //You also set the location of the file save here. I use desktop or a work folder.
    When done setting your file attributes - click save and then continue ->

    3- Click “New” in the ridged bodies tab

    4- Click “Create body from image” (You can leave the input fields as they are)

    5- Click on your image file that you wish to work with (this inserts the name in the save input)
    // was thrown off by the strange double save prompt at first and the gray text

    6- Save and continue on

    7-While creation mode is selected, begin placing down nodes around your objects perimeter. Continue clicking down nodes until you are all the way around - then connect to the first point to complete the operation. Do the same for all of your objects and it should look like the example.



    8- Click save and you are done making the collision mesh!!!!
    // You should now have 2 files to work with. An image file and a .json file.

    9-Import the image into an actor then import your .json onto it and you’re done!

    Hope this helps out!

  • sinbotsinbot Posts: 57Member, PRO

    wow excellent breakdown! i was initially wondering about doing this with this physics editor https://www.codeandweb.com/physicseditor that program does allow to create multiple collisions within a single image but GS doesn't seem to read it properly. but i do have Physics Body Editor as well. i'll give that a try. thanks bunker

  • BunkerBunker Posts: 36Member, PRO

    Glad I could help sinbot

    • May need to make an actor with alpha of 0, to hold the collision in the correct layer in regards to your player actor etc

    • some kind of issue with scaling of size doesn't work I think too so try not to change the size of the actor? (not sure)

    looking forward to the built-in collision editor!!!

Sign In or Register to comment.