[PLUGIN] Polygon (update 2013-04-23)

0 favourites
From the Asset Store
Fantasy Game includes more than 600 sound effects inspired by hit computer games like World of Warcraft and Diablo.
  • Hey, just curious, Yann, when you created your 3D application of the polygon plugin, did you just throw in quarternians to tell it where to put vertices? I've been trying to apply it that way, but I'm getting some weird effects. (almost looks like an extra, uncreated vertice?) And the frame rate drops when each poly is drawn. Not by much though, it won't be hard for me to work around that. I'm just curious as to how you applied it.

  • 🎊🎇🎉🎈🙌𝓦𝓞𝓡𝓚𝓢 𝓐𝓜𝓐𝓩𝓘𝓝𝓖!🙌🎈🎉🎇🎊 behaviors and effects seems to work perfect. The only thing it seems to be missing is the ability to add it to families in C2. This is something I really needed for my main project.

  • Yann is it possible to draw a circle using your polygon plugin and could you please provide an Capx example with JSON polygon importing? Preferably a circle XD.

    CloveltOc yeah that would be awesome if it supported Metaplot, or vise versa.

  • A circle isn't a polygon. You can approximate a circle using a regular polygon with a lot of sides

    I won't provide a capx, 'cause I'm lazy, but the pseudocode would look like:

    sides  = 32
    radius = 100
    pos_x  = 200
    pos_y  = 300
    
    angle_step = 360 / sides
    for i from 0 to sides:
         angle = angle_step * i
         x = pos_x + cos(angle) * radius
         y = pos_y + sin(angle) * radius
         addVertex(x,y)
    [/code:3dq0ztn5]
    
    something like that.
  • Was there ever a feature added to this plugin to fill the polygon with a sprite or a texture?

  • A circle isn't a polygon. You can approximate a circle using a regular polygon with a lot of sides

    I won't provide a capx, 'cause I'm lazy, but the pseudocode would look like:

    > sides  = 32
    radius = 100
    pos_x  = 200
    pos_y  = 300
    
    angle_step = 360 / sides
    for i from 0 to sides:
         angle = angle_step * i
         x = pos_x + cos(angle) * radius
         y = pos_y + sin(angle) * radius
         addVertex(x,y)
    [/code:22sufu5c]
    
    something like that.
    

    One neither is a square, but they can both be formed with polygons. Two, yeah or the following with the polygon plugin:

    "x": 59.000000, "y": 53.000000
    "x": 50.702869, "y": 93.947128
    "x": 27.074638, "y": 128.660431
    "x": -8.287506, "y": 151.855103
    "x": -50.000000, "y": 160.000000
    "x": -91.712494, "y": 151.855103
    "x": -127.074638, "y": 128.660431
    "x": -150.702866, "y": 93.947128
    "x": -159.000000, "y": 53.000000
    "x": -150.702866, "y": 12.052873
    "x": -127.074638, "y": -22.660425
    "x": -91.712494, "y": -45.855110
    "x": -50.000000, "y": -54.000000
    "x": -8.287506, "y": -45.855110
    "x":27.074638, "y": -22.660425
    "x": 50.702869, "y": 12.052873[/code:22sufu5c]
    
    You could also form a hectogon and get a nice circular shape as well.
  • Hosting the plugin on my DropBox, because original link seems broken.

    ***removed lnk***

    Referring to :

  • Yann

    Hi, any chance to make it work with chipmunk physics? I tried, when I set up it as polygon in chipmunk I got an error: moment of inertia couldn’t be 0 . Any idea?

  • Demkamen

    Sorry, I've never used chipmunk physics, I have no idea how it works or how you have to setup your polygon for it to work properly.

    I'd say if it's working with Box2D, it's probably not coming from an issue with the polygon plugin. Also "moment of inertia" doesn't look like something to do with shapes, but motion. Just thinking out "loud" here, but yeah, I'm a bit too lazy to download the behavior, fire up c2 and running test, sorry (:

  • Yann

    I've found out why it happens. First we need to add origin point, and second - activate chipmunk behaviour after starting layout.

    This plugin is cool, but what I really don't know: how to manage all this points for big levels. it's a pain to create a lot of vertex in layout and marked it as 1, 2, 3, etc. Any Idea maybe?

  • Demkamen

    curious, I provided the "Set Origin" action to be able to change the center of the polygon (like a pivot point), most people would never use it though. What it does is just offsetting the position of the vertices and compensating by setting x and y of the object so the polygon doesn't seem to move. So it shouldn't change anything in regard to the chipmunk behaviour.

    Or maybe I misunderstand what you mean by "to add origin point", if you mean that you have to setup the vertices, then yes, since the physics engine need the polygon to work.

    As far as managing points for big levels, well... C2 doesn't have any SDK to design any kind of advanced editor,... well, any kind of editor really, I remember being desesperate about the look of the plugin in the editor, I mean... I couldn't find any good way to display it. It would have been nice to at least be able to leverage the collision polygon tool of the image editor, but alas...

    I guess I could have put a property in the property editor where you could have listed vertices... But it seemed at the time, and still today, kind of useless...

    What I would advise is to look for some tool (or maybe even make one in C2) where you can create polygons and export a json, and then load it and rebuild the polygon by looping through the points defined in the json...

    (hm... I just realized that there's two AsJSON expression... just try one that work :D... not sure I'll ever really update that plugin... if I do, one day, I might actually implement what I mentionned earlier, the property with the list of vertices... but meh... )

  • Yann

    [quote:1amv21xs]Or maybe I misunderstand what you mean by "to add origin point", if you mean that you have to setup the vertices, then yes, since the physics engine need the polygon to work.

    no, no, you understood right, origin point - the center of an object, you have the special code for it. Maybe chipmunk need it to use as the center of the mass (don't really know, will check).

    [quote:1amv21xs]What I would advise is to look for some tool (or maybe even make one in C2) where you can create polygons and export a json, and then load it and rebuild the polygon by looping through the points defined in the json...

    this is not good solution for me. Just imagine, I have a really big levels with a lot of physics object on it, and every minute I change position of something, or level geometry. It's a pain to manage 2 level editor and syn them every minutes using json string.

    And it's really sad that current level editor in c2 doesn't support such tools which useful in level design. I have to use a lot of different sprites with textures to fill all this polygons(which is also now different sprites), instead of 1-2 texture of all geometry.

    [quote:1amv21xs](hm... I just realized that there's two AsJSON expression... just try one that work ... not sure I'll ever really update that plugin... if I do, one day, I might actually implement what I mentionned earlier, the property with the list of vertices... but meh... )

    ok, maybe I hard designed it using sprites as vertex

  • Hello! Does anyone have this plugin's link?

  • Try Construct 3

    Develop games in your browser. Powerful, performant & highly capable.

    Try Now Construct 3 users don't see these ads
  • Yeah, the new forum thingy borked some bbcode tags. The link was in the first post but hard to find

    Here it is polygon.zip

Jump to:
Active Users
There are 1 visitors browsing this topic (0 users and 1 guests)