Creating a Moving Platform

Niraj Karki
2 min readAug 2, 2021

--

2.5D Game Development

Objective: create a moving platform

Let us start with creating two empty gameobject which will determine the position the platform is going to move towards.

Then create a script called moving platform where we will be creating a moving conditions.

Inside the script, create a transform variable which will store the two position gameobject so that platform will move from point A to point B and vice versa. Then one script to store the destination of the platform and finally a float variable to determine the speed at which the platform moves.

Then create a function where we check the current location of the platform and if it is on point A or just reached point A then the destination will change to point B and vice versa.

And finally call the function to check whether the destination has changed and then move the platform to the destination.

And this is the result.

--

--

No responses yet