It moves! Moving Platforms.

Surprising me, the logic for this is basically the same as the 3d Stealth game’s Guard AI. I guess in reality I shouldn’t have been surprised.

First like the guards, we set up waypoints and make them empty objects. Then comes the code which is very similar.

However there was a problem…

… the character just slides right off the platform!

So how do I get to this?

The simple way to do this is to make sure that the Player gets Parented to the platform and moves along with it. When the player leaves, they get unparented.

The last thing to keep in mind which is very important is using FixedUpdate instead of Update for the movement of the platform. This will make sure that the Player stays on smoothly by forcing a 60FPS call on the code. Else the player may not even stay on, or will jitter a lot.

The last thing to do is zero everything out and make it its own prefab.

With that I can just duplicate these moving platforms and add more wherever and with whatever waypoints I want! Modularity!

See you next post!




Love podcasts or audiobooks? Learn on the go with our new app.

Recommended from Medium

Why I decided to create a Blog?

[CLI] Command Line CheatSheet

NFTMARS IDO Platform: MoonPad!

HTML Stands for Hyper text markup language

It is Never too Late to Learn How to Program

ASP.NET MVC for Django developers

How to solve your problems with the help of an App?

Get the Medium app

A button that says 'Download on the App Store', and if clicked it will lead you to the iOS App store
A button that says 'Get it on, Google Play', and if clicked it will lead you to the Google Play store
Edward Kim

Edward Kim

More from Medium

Let’s create an Elevator in Unity

Thrust into it — Giving Our Player Thrusters

Player Lives Display

Platformer: Free Falling & Landing