0
\$\begingroup\$

I am implementing horizontal moving platforms in my 2D platformer.

The way it's implemented currently, when my player lands on a moving platform, he is reparented to it so that his position updates in line with the moving platform.

The player is moved perfectly in sync with the platform, which has a constant velocity. The player's acceleration and velocity are not altered in any way to achieve this movement. It's free because the player is now a child of the platform.

Because I use local position in all of my player's movement code, my player is still free to move left and right relative to the moving platform.

This works really well.

I notice, however, that when my player runs along the platform in the same direction as it's moving, there is a sense of moving fast. When he runs against the platform, there is a sense of sluggishness.

I know that relative to the platform my player is moving at the same velocity in both directions, but because he traverses more global distance than normal when moving with the platform, there is a sense of speed, and because he traverses less global distance than normal when moving against the platform, there is a sense of sluggishness.

I believe the sense of speed and sluggishness are like psychological illusions. If my player stands on my moving platforms, it takes the same amount of time for him to traverse them from left to right as right to left, so I know that local velocity with respect to the platforms is working. It's more of just a psychological effect I'm trying to mitigate, I think.

So my question is: Are there any ways of mitigating these effects? How do you deal with this problem?

I am working in Godot, but would prefer an engine-neutral explanation of ways to avoid this effect.

It may or may not be relevant, but I have a smoothly scrolling camera which lerps to my player's position, as well as parallax backgrounds.

\$\endgroup\$
1
\$\begingroup\$

Although I haven't seen code, I believe you experience this problem because you add the platform's speed with the player's speed.

For example, imagine a moving platform is moving towards the +X axis, then you increase character's speed on the X axis by the platform's speed. When you move the character independently towards the +X axis, you add the character's speed as well, so the final result is the character will move towards the +X axis with a speed of platformSpeed + characterSpeed.

Similarly, if you move the character towards the -X axis, the result will be platformSpeed - characterSpeed. Assuming that platformSpeed is half of characterSpeed, on the first case the character moves x1.5 times its normal speed when moving on the same axis as the platform, but x0.5 times when moving to the opposite direction.

How do you solve this? I'm not sure how you've implemented speed in your project, but a good solution would be to separate platform's and character's movement. When the platform moves 5 units to the +X axis for example, the player moves the same amount of units with it, without touching its speed or any other value. When the character is to be moved around, it has already been affected by the platform, so only move it based on its speed.


If everything is functionally working, and you are only concerned about the visuals, like the character seems to be moving rightwards faster, but in reality it moves at the same speed, then you should take a look at the camera.

If your camera is moving smoothly towards the character, it moves that as long as the character is on the platform, the camera will constantly move towards the platform. So if the character moves on the same direction, the camera will look like its moving extra fast, because it will have to scroll more distance.

A solution would be to make the camera not move smoothly while the character is on the platform, or make it move faster to its looking target, so it doesn't move around for that long.

\$\endgroup\$
  • \$\begingroup\$ Added some more detail in the question. The player's movement code (acceleration and velocity) isn't affected at all by the movingly platform. \$\endgroup\$ – GoldenGremlin Oct 23 '18 at 14:52
  • 1
    \$\begingroup\$ @dietestus just re-read your question, when you say "there is a sense of moving fast" do you mean that the movement works as expected, but it gives the wrong impression to the viewer that it moves too fast/slow? So your question is more like how to make it more obvious that the speed is the same? \$\endgroup\$ – TomTsagk Oct 23 '18 at 14:58
  • \$\begingroup\$ Yes. I believe the sense of speed and sluggishness are like psychological illusions. If my player stands on my moving platforms, it takes the same amount of time for him to traverse them from left to right as right to left, so I know that local velocity with respect to the platforms is working. It's more of just a psychological effect I'm trying to mitigate, I think. \$\endgroup\$ – GoldenGremlin Oct 23 '18 at 15:06
  • 1
    \$\begingroup\$ @dietestus You should have included that in your question as it seems pretty important. I've edited my answer with some suggestions of what would be causing it and how to fix it. Since this is a visual issue it would be very useful if you could provide screenshots. \$\endgroup\$ – TomTsagk Oct 23 '18 at 15:13
0
\$\begingroup\$

In your movement code get the velocity of your parent. If it's not 0 then multiply it by some constant, like 0..1 and subtract from Players speed.

By changing the constant parameter you could scale and tweak this effect.

\$\endgroup\$

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.