City Tower Crane - UE5 - AGX Dynamics for Unreal

I’m exicted to announce that AGX Dynamics for Unreal is now available in Unreal Engine 5! :grinning:

To mark this occasion, we wanted to merge majestic with majestic: placing a 105 m (344 foot) Tower Crane in the City Sample environment created by Epic Games.

The physics driving the Tower Crane, Wires and Concrete weight is Algoryx’s AGX Dynamics, available through the AGX Dynamics for Unreal plugin.
It brings engineering grade physic to Unreal Engine.
The Tower Crane can be controlled by keyboard inputs.

Now you too can try it out. In this post, I’ll go over each step necessary to set everything up.

First, there are some prerequisites:

  1. Download and install Unreal Engine 5.
  2. Download and install AGX Dynamics for Unreal from the Epic Games Marketplace.
  3. Get your free evaluation license here.
  4. Download the City Sample project.
  5. Download the Tower Crane Assets zip-file and unzip it.

Now, you should have all major parts that are needed. The final steps are to put it all together:

  1. Copy everything from the Content directory of the unzipped zip-file from step 5 above to the Content directory of the City Sample project. Do the same for the Config directory.
  2. Start the City Sample project.
  3. Activate AGX Dynamics for Unreal. This is achieved by selecting (in the Unreal Editor) Edit > Plugins and under the Physics category, find and activate the AGX Dynamics for Unreal plugin.
  4. Activate the AGX Dynamics for Unreal plugin using your trial license. Instructions are available in the email that you received together with the license.
  5. Open the Small_City_LVL map that is included in the project.
  6. Setup keyboard inputs. Select Edit > Project Settings and under Engine, find the Input item.
    Input
    Select Import and browse to the TowerCraneInput.ini file located in the CitySample/Config directory. You should now have the following Axis Mappings:
    KeyboardInputs
  7. Select the BP_TowerCrane_GameMode.

    A thing to note here is that now also the Game State has been changed (to GameStateBase). By default, there is a Blueprint instance in the World Outliner called BP_Nightmode. This Blueprint will assume the Game State is the CitySampleGameState and it will try to bind some events to it. This will cause a runtime error since we now use the Game State GameStateBase. This can simply be fixed by not calling the Bind Event nodes in the BP_Nightmode Blueprint and just route past those as shown in the image below.

At this point, the project should be completely set up. From the Content browser, drag the BP_TowerCrane into the World. It is located in Content/TowerCrane/Models/TowerCrane/Blueprint.
Also, one or several concrete weights BP_ConcreteWeight can be added from Content/TowerCrane/Models/Weight/Blueprint.

Interacting with other objects
In order to make the Tower Crane, crane hook or concrete weight interact with other objects of the environment, AGX Dynamics must be made aware of their presence.
A static collision geometry can be obtained by adding an AGX Trimesh Shape Component as a child to any Static Mesh Component or Instanced Static Mesh Component.

Trimesh

When pressing Play, the triangle information of the Static Mesh Component will be read and a collision shape will be automatically created for it.

Similarly, some objects can also be made into Rigid Bodies, such that they will move when affected by external forces (and fall under gravity).
This can be done by creating an AGX Rigid Body Component as a child to a Static Mesh Component. Then, create an AGX Trimesh Shape Component as a child to the AGX Rigid Body Component as shown in the image below.

Note that the Static Mesh Component has to be set to Movable, and the AGX Rigid Body Component must have its transform target set to Root.
Many of the Meshes in the City Sample environment are set to Static in their parent Blueprint, and others actually comprise several objects in the world, thus not making great candidates for physics simulations.
It is however possible to create new Rigid Bodies with either primitive shapes or other Static Mesh Components and add those to the World. More information on how to use AGX Dynamics for Unreal is avaiable in the User Manual.

4 Likes