© The Author(s), under exclusive license to APress Media, LLC, part of Springer Nature 2024
C. HardmanGame Programming with Unity and C#https://doi.org/10.1007/978-1-4842-9720-9_41

41. Moving Platforms

Casey Hardman1  
(1)
West Palm Beach, FL, USA
 

In this chapter, we’ll implement a moving, floating platform that travels back and forth between two locations, and we’ll implement a simple system that allows the Player to stand on these platforms and ride them as they move. This will be done by making the platform become the parent of the Player when the Player lands on the platform.

We’ll also allow individual objects controlled by a Rigidbody to stick to the platform as it moves.

Platform Movement

First, we need a script that makes a platform move back ...

Get Game Programming with Unity and C#: A Complete Beginner’s Guide now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.