I have a game with moving floating platforms. The simplest and most dynamic approach to achieving the correct relative speed is simply to make adjustments to the speed. Here is a simplified version of what I'm doing to achieve this.
In my game loop, I have the following:
if heroOnBridge { hero.extraMotion = floatingBridge.physicsBody!.velocity } else { hero.extraMotion = CGVector(dx:0,dy:0) }
Here, what I am doing is constantly looking to see if my hero is on a moving bridge, if then I set the hero’s “extra movement” property to the speed of the bridge I'm on. If I'm not on the bridge, then I don't add any extra speed. Please note that I am not showing how the value of heroOnBridge is calculated, because it really depends on how you determine if you are on the platform. In my case, I assume that you are on the platform if you cross the platform frame and are on the ground.
Then, in the area where I calculate the speed of my hero depending on his direction (left, right, jumps, etc.), I simply add extraMotion to the speed of the hero.
If you don't already know this, you have an area in the game loop to handle the movement of your characters. This will allow you to make changes to the speed of your hero depending on certain factors (in the air, jumping, moving left / right, on the platform, etc.).
If you need further help calculating part of the speed, let me know and I will send more of my code. You can also read my answer here for a smooth and dynamic speed reference.
Remember that for the most part you never want to directly set the position of something, always try to set the necessary speed to reach this position over a period of time. This prevents a very unstable and unpredictable movement.