Pinning Issues

  • Hi, when positioning an object at another object's position every frame (or pinning) everything is working great but if I want to pin that object to an already pinned object (double pin?) the second object will alway lag behind the movement which look bad.

    This is a real pain and it means (to get around this) that for UI elements I am force to illogically organize everything into just a two layered structure and position everything in code at relative offsets. Of course once you introduce different aspect ratios into the mix chaos ensues.

    If the pin behaviour just worked how it should everything would be SO much easier.

    Is there a fix on the horizon for this?

  • Have you considered pining everything to the first object?

  • yeah, there is no way around the lag if you double pin...

    so, like orlic said just pin everything to the same base object.

    I make control panels, and have plain buttons that have the normal/hover/down animations, then I have text and icons for each button. Every icon and text object knows what button it belongs to, and it knows what panel object it should be pinned to (using instance variables).

    you can have as many layers of objects as you want, as long as everything that needs to drag together is pinned to the same base.

  • Actually, it's possible to double-pin (and even triple, quadruple, quintuple..) and avoid the lag. You just need to make sure that every next pinned object was created after the object it's pinned to.

    So if you have Sprite2 pinned to Sprite1, and Sprite3 pinned to Sprite2, they will move without lagging as long as Sprite3 was created after Sprite2.

    Seems like only the object creation order is important (not the instance UID or object name).

    If you are pinning instances of the same object to each other, then I guess they need to be pinned in the same order you added them to the layout (by their UID).

  • wow! how have I never heard that, or stumbled on it?

    I just did a few quick tests...

    if the objects being pinned are all instances of the same object, then UID or creation order does not seem to matter at all.

    However, if you are pinning together a chain of different object types, then it matters what order they were added to the project (not the UID or order they are created in on the layout).

    So, to avoid lag, you can only pin an object to another object type that was added to the project before the object being pinned.

    just to make sure, I closed the project, opened the .caproj file and changed the order of a sprite, saved, then opened the project in C2 and then there was lag - both in preview mode and after exporting.

    so, that is a pretty big condition, but now I know it is possible!

  • So it's based on the order they are added to the project? In my project I added the button text (which is lagging) to the project way after I added the initial sprite (button base) so not sure this is correct. If however this is the case, is there a way to re-order how they were added without having to delete and reimport.

    Btw..surely this is quite a major c3 bug that should be fixed right?

  • Grimmy You are doing something wrong. See this demo, try dragging the blue sprite:

    dropbox.com/s/sez72gozmagqipl/PinMany.c3p

    Objects were created in the following order: Sprite, Sprite2, Text, Sprite3

    As a result, Text pinned to Sprite2 doesn't lag. Text pinned to Sprite3 is lagging.

  • as far as I know, the only ways to change the order would be to start a new version of your project, or download a copy of your project to your hard drive, unzip the whole project, open the project.c3proj file in a text editor.

    near the beginning is a section called ObjectTypes, I haven't tried this with C3 (only tried in C2), but if you rearrange the items into the order you want to pin in, then it should eliminate the lag.

    make sure you don't break the code - each item has a comma after it except the last item, so watch out for that.

    then save the file, re-zip the whole thing, and open in C3 and test.

    this seems like a poor way to deal with this problem though, and if it isn't documented anywhere there is no guaranty that a future update wont change how this works.

    pinning everything to the same base object seems easier to me, and more likely to continue working in the future. Plus, if you have overlapping panels (as I often do) then knowing all the objects that belong to a panel makes it easier to pick the objects to move a panel to the front, or send it to the back, or close it.

    EDIT: just tried rearranging the ObjectTypes section in Dop's sample file, and it does fix the lag.

  • Try Construct 3

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

    Try Now Construct 3 users don't see these ads
  • I remember seeing a post on twitter stating that items that are all in the same subfolder will not lag. Not sure if that's still true (or if it ever was actually XD )

  • LukeW Funnily enough, it also depends on the order in which you add objects to the folder. If you take the example I posted earlier and place all objects into a folder, three sprites first, and then the Text object, then the text will not be lagging.

    But if you put Sprite3 last, one text instance will still be lagging.

  • Wow. There are some very strange discoveries found in this thread

  • Well I tried the sub folder re-arrangement idea but that had no effect for me. My objects still have the lag :(

    Unfortunately to pin each object based on offsets from the root object would be ridiculously time consuming just to get around this 'engine' bug, so really that's not an option.

  • Can you share your project file?

  • Sure its here: https://www.dropbox.com/s/k0edvgvqqa8qwed/C3Menus.c3p?dl=0

    Click the bottom right button to call the popup. You will see the lag on the popup buttons.

    On e_menus event sheet (line 12) you can see that Im positioning the button text every frame at the same position as the button sprite (buttpon_generic)

  • Your ButtonText1 object is not pinned to the button! That's why it's lagging.

    Pin updates object position at the end of the tick, after all other events. So your event "On every tick ButtonText1 set position to button" is executed, and then Pin behavior moves the button to another position. And the text is left behind!

    You need to pin the text to the button, or (preferably) to the parent panel.

    .

    So, to sum up, you can double-pin and avoid the lag if you created objects in the right order. Or you can position multiple objects one to another with events without pinning. But don't position an object to another pinned and moving object. This will always cause lagging.

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