Jump to content

* * * * *
Contents


In this tutorial you learn how to set up platforms. Platforms can be used for instance for elevators. Open up the Moving platforms.map from the tutorial project.

Attached Image: 1.PNG

Setting Up Waypoints

The platforms you see in the scene are simple CSG boxes. They have the following physics settings: physics type is set to "Rigidbody", Mass is set to '2' and Collision type to "Prop".

Attached Image: 2.PNG

Attached on these platform is the script platform.lua. You can set the speed and target platform. The speeds indicates how fast a platform moves towards its target. The target is the position/location the platform should move to first.

Attached Image: 3.PNG

The colored icon (as shown in the image below) represents a pivot. Pivots have no physics, don't render anything and are basically just position entities. Pivots can be created from the Objects tab under Miscellaneous.

Attached Image: 4.PNG

Select a waypoint pivot. You can see the platformwaypoint .lua. Here you can drag a new target on top of it. If you click on the ‘GoTo’ button, the scene will focus on the object in the scene. Select the platform. You can see that we can set a target here as well.

Attached Image: 5.png

Creating a Moving Platform

We create 3 pivots in the scene. We call them W1, W2 and W3. Select all 3 pivots by holding the CTRL key and selecting them in either the viewports or in the scene tab.

Attached Image: 4.PNG

We attach the platformwaypoint script to it. Select the first Waypoint. Drag Waypoint 2 in to the target property of Waypoint 1. Do the same thing for the other waypoints.

Attached Image: 5.png

Create a new CSG box at the first pivot and attach the platform script. Set as a target, the second waypoint. Don’t forget to set the mass to ‘2’ and collision type to prop.

Attached Image: 6.PNG

Reposition the Character Controller

Place the character controller a little closer so that you don’t have to jump the first 4 platforms. You can now try out your newly created platform.

Attached Image: 9.PNG


0 Comments