Search Unity

2D collisions and custom meshes?

Discussion in '2D' started by Andrige_, Nov 14, 2013.

  1. Andrige_

    Andrige_

    Joined:
    Oct 6, 2013
    Posts:
    12
    So, with the addition of the Polygon Collider component, we can create custom colliders inside the editor.

    That is great, but...

    I am using a tool called Polymesh Tool prior to this update, and it has a few advantages over the one Unity gives us.

    • It creates a 2D mesh that can also have a texture (great for land-fill).
    • It can extrude shapes.
    • It can create curved shapes very easily and in a more automated fashion.
    • You can automatically redefine the number of vertices used to build up the shape by adjusting a slider, and still retain the outline.
    • Less relevant of course, but it can create a collision mesh with depth suitable for the 3D rigidbodies.
    • It's free.
    I much prefer this plugin's way of doing things, and my current prototype level is built using this. So I wonder... is there some way to get the 2D collider to work with a custom mesh, as opposed to the Unity provided one that is generated by modifying the edges? Because the plugin first and foremost generates a 2D plane for the texture fill (it can then be asked to generate the 3D collider mesh), shouldn't that be compatible with the 2D collision system in place in Unity?

    I have contacted the author of the plugin, but said person was unfortunately unable to continue updating the project to work with Unity 4.3.

    Personally I am not much of a programmer to take on the project (might be one day though), but the code is available on GitHub and is free to use (see the page for more information).

    Share me your thoughts, 2D community?
     

    Attached Files:

    Last edited: Nov 14, 2013
  2. Eric5h5

    Eric5h5

    Volunteer Moderator Moderator

    Joined:
    Jul 19, 2006
    Posts:
    32,401
    The 2D physics system is entirely separate from the 3D physics system, so it doesn't seem like it would be possible without rewriting the plugin.

    --Eric
     
  3. Swamy

    Swamy

    Joined:
    Feb 12, 2013
    Posts:
    14
    Hi Andrige,

    for the game I'm currently developing I faced a similar problem. So I wrote a tool similar to the Polymesh tool which works with the new 2D collider objects. You can draw stuff in the scene view similar to other vector drawing programs. I'm gonna put it on the Assets Store these days. But if you want to have a test before the Unity Asset Store process is done, just send me a PM with your contact details and I can send you on the free Lite version via mail. I should be able to get it done by this weekend and I would love to get some feedback.

    Bernhard
     
  4. Kurius

    Kurius

    Joined:
    Sep 29, 2013
    Posts:
    412
    @Swamy what would be amazing is if you could get it to also be dynamically adjustable at runtime, thus simulating 2D destructible terrain!
     
  5. Swamy

    Swamy

    Joined:
    Feb 12, 2013
    Posts:
    14
    @Kurius interesting idea. The project I'm working on is more focused on provided tools for the level designer and speed up the level creation process. But it is a really interesting thought and I definitely put that down as a requested feature - or maybe even a different plugin.
     
  6. Andrige_

    Andrige_

    Joined:
    Oct 6, 2013
    Posts:
    12
    That sound great! I've been busy these last 24 hours (sorry for the lack of response in the thread!), but I'll send you my contact details once I get the opportunity.
     
  7. Swamy

    Swamy

    Joined:
    Feb 12, 2013
    Posts:
    14
    Don't worry, I'm in the middle of getting things sorted out for the Asset Store, so whenever you are ready.
     
  8. Andrige_

    Andrige_

    Joined:
    Oct 6, 2013
    Posts:
    12
    I've sent you a PM. I believe it's hard to see when you get one so I figured I'd post.
    The forum seems to do its best to disable any PM/image sharing/signatures by default in the settings.
     
  9. Swamy

    Swamy

    Joined:
    Feb 12, 2013
    Posts:
    14
    Yeah it's not very prominent really. Any ways I sent you a mail now :)