1 min read

[11/50] Collapse platforms on player contact using Chaos Physics in Unreal

An image of a collapsing platform in a video game as thought by Stable Diffusion.
Stable Diffusion thinks this is a collapsing platform in a video game.

A fun mechanic involving platforms is to collapse them on player contact giving the player just enough time to touch and move to the next. It adds to the sense of urgency and adds another layer of challenge to the platform system.

In this post we look at a simple Blueprint to create this mechanic within Unreal.

The Blueprint component tree

The component tree for our collapsible platform is pretty straight forward. We have a Box Collision component to detect player overlaps (collisions) which wraps the actual platform in Geometry Collection. For those unfamiliar, Geometry Collections are at the heart of destruction system within Chaos Physics. The official guide does a good job of introducing the same and walking through the setup.

Next we have the Field System Component and the Box Falloff which allow the programmer/designer to control the force applied upon collision.

Blueprint graph for collapsing platforms
Blueprint graph for collapsing platforms

Finally, the Blueprint script involves the following:

  • When overlap is detected with the Box Component, check if it is the player.
  • If yes, use a Do Once gate to make sure we do not trigger multiple collapse.
  • And behind the gate, we add the transient field.
  • In our case, we disable the collisions against the collapsed platform for performance reason but your use case may vary.