Leadwerks Game Engine

Leadwerks Game Engine

评价数不足
Tutorial - Moving platforms
由 Aggror 和其他 1 人合作完成
This tutorial will learn you how to set up moving platforms.
   
奖励
收藏
已收藏
取消收藏
Intro
Platforms can be used for instance for platforms. Open up the Moving platforms.map from the tutorial project.



How are waypoints set up?
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 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.



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.




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.

Creating a new 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.




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.



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.

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.

1 条留言
den24 2023 年 11 月 26 日 下午 3:31 
thanks!