Today I'd like to talk about my latest edition to my 3rd person platformer unity demo, moving platforms.
When I think of moving platforms in games, I think of 1 of 2 things: 'Platforming speed runs', with sequences of jumps where a range of platforms are moving in all kinds of directions, or 'transport platforms', where you stand on a platform to be elevated or moved to somewhere else whilst experiencing limited movement of sorts.
Whenever moving platforms are involved, you need to think about how many forces and axis the player has to deal with. In games such as Super Mario Galaxy, where not only is the game in 3 dimension, but your direction of gravity is also constantly changing. Looking at how most of their platforms work, any platforms that involve jumping onto/off and between platforms is usually done on moving platforms that only translate in movement following 1 gravity source point, and not rotating through multiple gravity zones. When moving platforms involve rotating in space from 1 gravity zone to another, the player more often than not simply walks onto the platform and then it will take the player where they need to go without the need to jump. Jumping off the platform at this stage will most likely throw you into the void of space if you even can control the player over that shifting period.
This is to accommodate player skill and how their platforms move the player. As soon as Mario's feet touch the platform, they are then stuck to and moved by the platform. The instant he jumps and leaves the ground, he is free. This is good for platforming sequences where you must jump from 1 platform to the next, but if rotation and gravity direction is changing, that will just make life extremely difficult.
Some games make it so that even when jumping, the player is still moved by the platforms, making it even harder for the player to accidentally fall off the platform right after they jump whilst still on it.
Switching to my implementation, I have options to handle these situations. I had setup a moving platform handler which contains a start, end, and pivot point for a line of moving platforms that are spawn at 1 end and disappear at the other. The rate of platform appearing and the speed at which they travel along the path can be changed with public variables.
Every time a platform is generated, it has it's own height check variable. This reflects how high up the player can be above the platform until it stops moving the player. By default I left this at a minimal 0.08 to that when only standing on the platform will it move it. If I bumped this up to 3, then even when jumping, the platform will still move the player is relation to its movement.
The 1 flaw with my system is that I don't rotate the player at the same rate of the moving platforms. I couldn't figure out how to get this number accurately in time. Not only this, but the player will move in correspondence with the centre of the moving platform, not where on the moving platform they are standing on. This means when standing at the edges, you will see you played drift across the surface of the moving platform ever so slightly
Other than that, with the starting, end, pivot point, spawn rate, and speed options I'm very happy with what I created.
Thanks for reading and I'll see you in my final blog post!