HFFWS Moving Platform Tutorial

August 13, 2019

Human Fall Flat Workshop

Moving Platform Tutorial

Youtube – Moving Platform Tutorial in Unity for Human Fall Flat

By: Gotcha McFee

To start, they just went to the IntermediateLevel 1 scene to grab a copy of the moving platform prefab from there. They just placed this in a prefabs folder to use later.

This moving platform has a ton of script components on it, but the main one they focused on was called “Signal Math Nul”. Changing the second input value here changes how quickly the moving platform changes directions. A high value will make it go back to start very quickly, where a low number will take longer (and if it’s low enough, it will actually wait at the end point for some time before coming back).

Next, they showed that the child object, Axis, controls a lot about how the platform moves. By rotating this object, you can change the direction the platform moves. The other simple variables they show are:

  • Min Value: Normally just keep at zero
  • Max Value: Changes how far platform can move in given direction
  • Max Speed: Changes the top speed the platform can accelerate to
  • Max Acceleration: Changes how quickly the platform changes speed

These variables are pretty self-explanatory, but there are a few issues to note with them. Going back to the first problem where a platform that changes directions too quickly won’t even reach its maximum value, this needs to be checked when you change a platform’s Max Value. If you change this without giving it more time to change directions, it may not be ending up where you would plan on. Max Speed and Max Acceleration are values that need tested in game as they will contribute force and momentum to players that are on the platform. Having too high of values here can throw players off the platform and make it difficult to stay on.

Finally, they show that you can take this underlying foundation and place it on any object to make it move around. They child a new object to this entire setup and just turn off the old mesh components, but it’s actually easier to just change the base platform object’s Mesh Filter and Mesh Collider to the object you want (and then update the Mesh Renderer to fit this new mesh). This lets you use any mesh as a moving object.