Pin behavior position lag

0 favourites
From the Asset Store
Wall Pin Board is a hyper causal game developed for fun and inspired by YouTube video whose link is given in description
  • I'm using a pin behavior in some sprites that are pinned to one sprite that is moved by a touch plugin in a simple manner:

    is touching object? -> sprite: set position to Touch.X, Touch.Y

    the problem is, that the pinned objects are having sime kind of one frame lag (reminds me of a sprite->destroy bug), it looks like all pinned objects' positions are updated after frame draw on a following basis:

    run behaviors (set pinned objects' positions)
    run events (move the sprite that other sprites are pinned to)
    draw canvas

    in theory if you have an object FOO pinned to other object BAR that is pinned to some other object XYZ, when the XYZ object is moved, the BAR and FOO should always have XYZ's position. instead right now they have a lag of 1 frame for BAR and 2 frames for FOO. (and so on if you have more objects). this is not much of a problem on a 60fps computer screen, but on a mobile fon with fast moving objects it becomes visible and annoying.

    capx: http://www.mediafire.com/?wnshcwfanv1sci9

    I would much appreciate if this could be fixed :) thanks!

  • Try Construct 3

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

    Try Now Construct 3 users don't see these ads
  • I would not download from mediafire because there have many adds, suggestion, host your files on dropbox.

    Please, feel free to see my game and download his .capx from here, where I added many objects pinned to the player gadget and I didn't noticed any lag. Maybe is the phone hardware who can't keep all the math without delay, or, something else, but I believe you can figure out looking inside SandBOX code to make sure the first issue is not true.

  • they have ads, but a big green download button, also uploading is just dragging files to a browser window without installing any programs like dropbox, that's why i preffer mediafire and that is the main reason why I uninstalled dropbox actually. now back to the topic, in your code all the pinned object move so slow that you are not able to see any lag. if you actually downloaded my capx and tried it you would see the lag clearly :) cheers.

  • ...don't need to install dropbox program to use dropbox, just saying ;)

  • they have ads, but a big green download button, also uploading is just dragging files to a browser window without installing any programs like dropbox, that's why i preffer mediafire and that is the main reason why I uninstalled dropbox actually. now back to the topic, in your code all the pinned object move so slow that you are not able to see any lag. if you actually downloaded my capx and tried it you would see the lag clearly :) cheers.

    Even falling?

    In my job any advertisement block the entire site, and mediafire is one of the black listed here, so, sorry, I can't download anyway.

  • ...don't need to install dropbox program to use dropbox, just saying ;)

    didn't know that :) I will check it. in the meantime, maybe someone who's actually interested in the bug itself and not finding the best hosting options would see this? ;)

  • I'm at my house now.

    Confirmed, I did a new sample and checked the offset:

    dl.dropbox.com/u/47035927/temp/pin%20behavior%20bug.capx

    This happen on objects sub pinned on another pinned object interacting with the input cursor.

  • great, thanks! for all interested, the only thing you can do is actually pin all the objects to the first sprite that is moved, and I want to correct myself, indeed, the FIRST pinned objects doesn't seem to have a lag, the second and so on, does.

  • also, when you have some behavior that moves object and make an event to scroll to this object every tick, there's somewhat similar one frame lag, the object moves some pixels by behavior, then the frame is drawn, then the screen is scrolled to the position, then object moves, then next draw occurs.

  • I'm afraid I don't think this can be fixed: the Pin behavior is already coded to run *after* the events so it gets the latest position of the object. As you can see from this modified example there is no lag at all if you only use a single pin:

    http://dl.dropbox.com/u/15217362/nopinlag.capx

    The problem comes from using two behaviors at once. Construct 2 does not run behaviors in any particular order. So in this case the pin behaviors run in the wrong order and the second pin updates before the first, so it is always one frame behind. I don't think there's any good fix for this - it's how the engine has always worked. It's easy to workaround with events though, the Pin behavior is pretty simple. I'm afraid this appears to be the only solution. If you do it all by events you have exact control over the order it happens in, anyway.

  • ok, thanks

  • If you're still having the problem even after pinning everything to the moving sprite, it's probably because you have the scroll to behavior on your sprite too. I got around this by:

    1. remove the "scroll to" behavior

    2. instead, go to your even sheet and under system events, select scroll to object and choose the object you wish to follow.

    3. on the same event, set your sub objects position to the sprite.

    This forces the game to calculate your sub objects position after the scroll is calculated. The final event will look something like:

    Every tick

    • scroll to Sprite
    • set sub object position to sprite
  • Hi everyone,

    I know this topic is old, it seems that the updates fixed this problem.

    However, I'm working with Spriter and having this exact issue. I'm pinning a sprite form C2 to a imported sprite from Spriter, and it gets delayed.

    Even using other methods like updating position every tick has this delay going on.

    Any sugestions?

  • MonkeyBalls

    Hi everyone,

    I know this topic is old, it seems that the updates fixed this problem.

    However, I'm working with Spriter and having this exact issue. I'm pinning a sprite form C2 to a imported sprite from Spriter, and it gets delayed.

    Even using other methods like updating position every tick has this delay going on.

    Any sugestions?

    This a 4 year old 'closed' bug report, which the sticky specifically states that you should not post in.

    If you have an actual bug, please post a new bug report, remembering to fulfil all of the Bug Reporting Requirements.

    If it's just assistance you require, then please just post in the C2 'How Do I' section.

  • Hi everyone,

    I know this topic is old, it seems that the updates fixed this problem.

    However, I'm working with Spriter and having this exact issue. I'm pinning a sprite form C2 to a imported sprite from Spriter, and it gets delayed.

    Even using other methods like updating position every tick has this delay going on.

    Any sugestions?

    Hi did you manged to solve this issue by chance?

    im having the exact same problem.

    i apologize that i post this here.

    i tried to send a pm, but i didnt had enough rep points.

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