In this video, you will learn how to make a simple moving platform, which will parent your player every time you land on it. The platform will be moved according to waypoints, which will be created as empty game objects that will only contain transform component. The platform will be a child object of the main platform whose position is set to zero. The child platform can have any value, but the parent platform needs to have zero position, because otherwise the position of the child platform will also become zero. Now when you have set the platform, you need a simple script.
To make the platform move, you need the movement speed value, the platform waypoints and the index value. The detection of waypoints will be done through for-loops, that are important for bringing the platform into action. There are issues when it comes to parenting your player, especially if your player is a character controller. It does not stick to the platform when the character controller is enabled. Make sure that there is one more collider attached, that will be set to Is Trigger.
To fix the platform parent issue, you need to make sure that the collider of the platform will be turned on only when the player is on ground; otherwise it will be turned off when the player is jumping. The platform will revert its collider after two seconds.
Join this channel to get access to perks:
/ @kozmobotgames
Support the Creator of Kozmobot on the social networks!
CHECK OUT MY WEBSITE: http://kozmobot.com
INSTAGRAM: / kozmobot.channel
TIKTOK: / kozmobot.channel