# The weird moving platform problem

Ok so I have moving platforms .
Left and right
Up and down
Both have what I think is a problem

Let’s just fix left and right for now

Left and right :-

When the player is on the moving platform when you press right ( to move right ) and the platform is moving left it’s hard to walk because of the force added to the moving platform .
But if the player is moving left for example and the platform is also moveing left the player moves normal (maybe even faster because the force of the moving platform is added to the player movement speed I think )

What I want ?
Is to make the player move normal when he is on the moving platform as he moves on any other platform .

Thanks for help …

I see what you’re talking about, but not sure it’s a bug you know

Let me expand on this, when you are on the moving platform this is the player inertial frame (the platform), the wrong player speed you see is because you are on another interial frame (the world, aka za warudo). In other words, the “real” player speed (in the object settings) will be = player speed on platform from world - platform speed (Galilean transformation), so the speed you see has the platform speed added as you were thinking, and this is constant, for example you can count the time it takes for the player to reach the platform edges (cross the platform distance) and you’ll see it takes the same time when it runs “slow” and “fast”, as in real life.
Physically speaking, it’s correct, we’re walking in a giant platform too and we don’t care if the planet goes left or right, our “real” speed (speed from the planet) is constant, even if a guy on Mars think we walk too slow when moving left and the planet is going to the right.

Now, talking about games, maaaaybe the desired effect would be an absolute constant speed, woul be nice to hear what others think about it, I’ll pay attention to other platformer games I play from now to check it

Aright that’s really interesting actually … I thought that this was a problem but i guess not .

OK so there is another problem with up and down platform,
but i want to talk about the problem in any moving object in game :-

So when you take a look at a moving platform (object) and the camera is moving with it … it feels like the platform (object) is skipping on the way it moves … like teleporting when it moves (i don’t know how to explain it . i hope you understand).
when the camera is still (not moving) the skipping goes away … So how to fix that ?

skipping means like glitching it’s way (i don’t know how to explain it but i hope you get the idea)

Thanks for replying btw

I previously tried two ways of dealing with horizontally moving platforms. This was with my own way of moving the player, rather than using the platformer behaviour.

1. Always adding the platform movement to the player movement. This leads to the player speeding up when moving in the same direction as the platform and slowing down when moving in the opposite direction.

2. Only adding the platform movement to the player when no keys are being pressed i.e. the player is standing still and being passively carried by the platform. As soon as a movement key is pressed the player’s speed becomes independent of the moving platform, which is treated as just another solid surface.

I found 2) produced the more “normal” gameplay for a platform game.

I clicked on this topic because I thought it would be about something else (more on that later)
I think what Lizard-13 said is pretty dead on, the apparent decrease in speed is mathematically sensible as the plane underneath you is moving in opposition to you, so it’s not really “wrong” although if you are looking for a workaround for the sake of smooth game play you’ll have to do a workaround where if the players direction is mismatched to the platform a slight speed boost is given.
Then you mentioned about the camera moving with the platform/player and the way it appears, this I can’t really think of many suggestions for, but it seems like MattLB’s suggestion might give you some help towards that.
Now, for the reason why I clicked on this topic, when I created platforms that went up and down, I noticed a tendency for the player to fall off the platform when it suddenly shifts from moving down to moving up, this is of course caused by the player’s sprites feet falling below the threshold of the platforms upper edge, theoretically decreasing the platform speed and/or increasing the “grab” tolerance for the player sprite would fix this but I could never find anything that both worked 100% and felt right from a game play perspective. If anyone else has a suggestion about that I’d love to hear what you use.

Do you directly assign the position of the player to that of the camera?
If yes you could reduce or even get rid of the skipping by smoothly moving the camera towards the player coordinates. Either via the “lerp” function (math expression) or by “Add a force to move towards an object” with a speed depending on the distance between the camera and the player position.

(or by “Add a force to move towards an object” with a speed depending on the distance between the camera and the player position)

Ok this seems important but i don’t understand what do you mean exactly ?
Could you explain more with an example ?

“Add a force to move toward an object” takes a speed in pixels per second as a parameter.
When your player is falling from a platform the distance the camera has to move from it’s old position to the new position of the player object will be greater than if your player is just standing on a platform that slowly moves left and right.
What I was trying to say is that you need to adjust the speed with which you move the camera depending on the speed the player is moving. Otherwise the player might leave the screen because the camera is too slow to follow.