I’m exicted to announce that AGX Dynamics for Unreal is now available in Unreal Engine 5!
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:
- Download and install Unreal Engine 5.
- Download and install AGX Dynamics for Unreal from the Epic Games Marketplace.
- Get your free evaluation license here.
- Download the City Sample project.
- 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:
- Copy everything from the
Content
directory of the unzipped zip-file from step 5 above to theContent
directory of the City Sample project. Do the same for theConfig
directory. - Start the City Sample project.
- Activate AGX Dynamics for Unreal. This is achieved by selecting (in the Unreal Editor)
Edit > Plugins
and under thePhysics
category, find and activate the AGX Dynamics for Unreal plugin. - Activate the AGX Dynamics for Unreal plugin using your trial license. Instructions are available in the email that you received together with the license.
- Open the Small_City_LVL map that is included in the project.
- Setup keyboard inputs. Select
Edit > Project Settings
and underEngine
, find theInput
item.
SelectImport
and browse to theTowerCraneInput.ini
file located in theCitySample/Config
directory. You should now have the following Axis Mappings:
- Select the BP_TowerCrane_GameMode.
A thing to note here is that now also theGame State
has been changed (toGameStateBase
). By default, there is a Blueprint instance in the World Outliner calledBP_Nightmode
. This Blueprint will assume theGame State
is theCitySampleGameState
and it will try to bind some events to it. This will cause a runtime error since we now use theGame State
GameStateBase
. This can simply be fixed by not calling theBind Event
nodes in theBP_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
.
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.