Player shakes when riding on a moving platform

Hello!

I have a moving platform that consist of a container with background sprite and text. I have to make it move in circles around some point (like here: http://www.html5gamedevs.com/topic/24435-rotating-a-spritebody-around-the-point-with-keeping-the-orientation/) I have tried different ways of moving (along a Path or setting angular velocity, but in any case when player jumps on it and rides, it starts to shake as though it cannot calculate the player position at once. With PathFollower the effect is not so strong (I am updating player position in the path update loop), it is almost good when riding the left half of the circle and gets much worse on the right half.

Any ideas what can cause that and how can I fix this problem? Thank you all for attention.

Can you post the code (and format it with the </> button) to give us a better idea?

@tony thanks for reply, I almost figured it out (one pixel discrepancy was causing the whole system to ruin :slight_smile:), but still have the text jitter problem. It is not just so bad, but I really wish it runs smoothly.

this.bg.startFollow({
      from: 0,
      to: 1,
      duration: this.bg.path.getLength()*7,
      yoyo: true
      repeat: -1,
      repeatDelay: repeatDelays[this.movement],
      ease: "Linear",
      onUpdate: () => { 
//some code
       this.adjustTextPosition();
      }
    });
  }

 adjustTextPosition(){
    this.text.setX(this.bg.getCenter().x - this.text.width/2);
    this.text.setY(this.bg.getCenter().y - this.text.height/2);
  }

this.bg is the sprite inside container and this.text is the text inside container

Total disclaimer - I’m probably just as new to Phaser as you are.

However, I’ve had jitter problems before, and you see that when the text is being updated a little bit after the background has moved.

I’m seeing you update the text position, but where/when does the background get updated?

That is a good point, but I guess it is not the case - background is the PathFollower itself and I’m updating text position in its onUpdate loop. Probably it gets behind because update happens after the background makes its move.
What helped you solve your jitter problems?

In the past, I remember having a problem where an draggable sprite wasn’t following the mouse. I think the problem in the end was that the position of the image was relying on some variables myX and myY that only got updated before the mouse had moved. So they coords were always one step behind.

Maybe onUpdate() is being called before the background itself changes its position?

@tony I think you are right. It really looks like just a small single step behind. So does it mean that onUpdate fires before the sprite updates itself? How did you fix your mouse drag problem?

Hm, is this Phaser2?

No, I’m using Phaser 3.

Sorry to jump in here, but can you share how you’ve attached the player to the platform? Are they able to walk around freely? I happen to also be working on a moving platform and my player is unable to remain on the platform.