Unreal Engine 4: Moving platforms V2

Unreal Engine 4: Moving platforms V2


I said that I was going to write a bonus post containing 5 bonuses. Here they are:

  1. Changeable timeline curve
  2. Making other objects be able to hit the button
  3. Chained lifts & lifts stopping when blocked
  4. Lift shooting projectile when it stops
  5. Rock smashing through the wall we made in the material instances post

1. Changeable timeline curve

To make the timeline curve public, well, you can’t. But, you can make the original timeline completely linear, and add a curve variable to the blueprint. What we do with the curve variable is this:


You add a Get Float Value function in between the Transition block and the “Set lift location” block and give the lift curve as the target and give the transition output as In Time. I also renamed the timeline output to Curve X because it isn’t the Lerp alpha now. And I gave the return value of the curve to the Lerp alpha.

Note: The original timeline curve HAS to be linear, otherwise the curve will be changed. To mathematically explain: Let Transition be F(x) and Lift Curve be G(x). If F(x) \neq xF \circ G \neq G(x). We want: F \circ G = G(x). So,  F(x) has to be  x! That means that F(x) is linear.

Now, create a curve, my curve is:


I deliberately made it weird, so that it is clear that it is working, and it is!

2. Making other objects be able to hit the button

For this, all you need to do is set “Simulation Generates Hit Events” in Collision to true for the button’s mesh component, and other objects can trigger the lift as well! Here is a picture:


3. Chained Lifts & lifts stopping when blocked

To chain lifts, you need to apply the steps above to the lift actors, so that they trigger a hit. But, that isn’t enough, because the lift is kinematic (moving where it is told by the BP, not obeying the laws of physics). But, If we enable physics the button will just roll off to the edge of the map. So, we need to solve this a different way. [That different way will make it so that lifts will stop when blocked too.]

And that different way will be checking the “Sweep” input on the Set Actor Location in the BP. This will effectively kill two birds with one stone, because enabling Sweep will make the actor act like a physics object, and make it move to anywhere (except inside objects) it wants! That is perfect because to chain the lifts, the lift needs to trigger the hit event. And since it now behaves like a physics object, it will trigger hit events, and stop when it touches objects.

4. Lift shooting projectile when it stops

This will be really hard to explain, so here is the picture of the BP:


What this does is:deep inhale When Transition is finished, it activates the projectile spawner part after the part where the state is set via Sequence. Then, if Shoot Projectile is true, it plays the given sound at the location of the lift. The process goes through GetActorTransform because the transform is used somewhere else. After the sound is played, the given projectile is spawned at the result of Compose Transform, which takes the given projectile transform and the lift’s transform. sigh

5. Rock smashing through the wall


And that’s all! By the way, I wanted to thank you for taking the time to read my posts. Take care and happy “unrealing”!


Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s