Foliage Physics require a foliage blueprint, but foliage blueprints require a number of assets to function correctly.
In this guide, we will be showing you how to import your custom foliage so that it is ready and prepeared to be applied to a Foliage Blueprint.
To summarise this page, you’ll need the following:
- A Static mesh
- a Skeletal mesh
- a Physics Asset
In this guide we will be only be covering the steps inside Unreal Engine.
If you need to learn how to create skinned skeletal meshes, you may want to find some tutorials on the topic for your own chosen 3D Software, as we do not provide documentation for external softwares.
However, here are some suggestions that might help you if you are unsure about where to start:
Static Mesh #
Your foliage Static Mesh must have some form of Simple Collision in order to be detected by our system.
Please do not use Complex Collision, as this will not work.
Note: Accurate collision data is crucial for our system’s foliage conversion process. Collision data is used to identify and convert foliage instances into blueprints. So if you ever encounter issues with foliages not converting to blueprints properly, be sure to double check your collision.
Skeletal Mesh #
When creating your skeletal mesh in your own 3D Software, please be aware that the number of bones you have will impact performance.
If your plant is very common, like a long grass or reed, we recommend having only 2-3 bones.
If it is unique and uncommon on your landscape, you can go upwards of 20 bones if necessary. But it’s best to keep bones to a minimum to boost performance.
When importing a skeletal mesh, the default settings for “Create Physics Asset” will be checked. This isn’t optimal, as the importing will cause this auto-creation to ignore creating physics bodies for small bones.
Generally, a lot of foliages can contain small bones, so this is a waste of time. Its best practice to uncheck “Create Physics Asset” upon importing your skeletal mesh, and instead create one manually after import.
Physics Asset #
Creating a Physics Asset #
Right click your Skeletal mesh.
Click Create > Physics Asset > Create and Assign.
For most foliages, it’s usually best to select “Capsule” as the primitive type, but you can change the default Primitive type to whatever your physics asset needs.
Uncheck “Walk Past Small Bones” and check “Create Body for All Bones” to ensure that each of your bones has a physics body.
Click “Create Asset“
Tweaking the Physics Asset #
Please open your Physics Asset so that you can tweak its properties and make it interact naturally.
Use the Tools and the Body Creation toolbox to re-generate the bodies that need to be different shapes.
Adjust the position, rotation, and scale of each body until it fits the mesh.
Recommendations #
While you are free to do what you want with your physics asset, there are some recommendations we’d like to provide to make it easier for you to produce similar results to our own physics assets.
Select the root bone’s Physics Body, and set its Physics Type to Kinematic.
This will keep the plant rooted to the ground, and prevent it from flying away when kicked by the player.
Set the Collision Response to Disabled if you don’t want anything being blocked by this body.
Select all the Physics Bodies, and uncheck “Enable Gravity”.
Doing this will ensure that the plant doesn’t immediately fall over under the weight of it’s own gravity when it is converted from a Foliage Instance to a Foliage Blueprint.
Optionally adjust the Mass, Linear Damping, and Angular Damping of each body, to make it seem like the bodies have the correct weight and resistance to movement.
Show the constraints of your physics actor by clicking the settings icon above your bodies, and selecting “Show Constraints“.
With each constraint selected, adjust the Angular Limits.
To give them a spring effect, go to Angular Motor tab and check the SLERP checkbox. Adjust the intensity of the spring effect by changing the Strength value.
We recommend viewing our own pre-designed physics assets as examples of what settings are suitable for different foliage types.
You can find these in their respective folders under Content / AlienPhysicsWorld / FoliageTypes
Naming Conventions #
Naming conventions are not strict, however, there is one rule you must follow if you plan to create Custom Foliage:
Ensure each foliage name is unique, so that one foliage name cannot be found inside another name.
Here are some examples of how to NOT name your foliages:
- BP_Gaspods_X
- BP_Gaspods_X_Destroyed
- SM_Gaspods_X
- SM_Gaspods_X_Destroyed
The reason the above names are bad is because BP_Gaspods_X_Destroyed contains BP_Gaspods_X.
To correct this, here some examples of how you SHOULD name your foliages:
- BP_Gaspods_X_Whole
- BP_Gaspods_X_Destroyed
- SM_Gaspods_X_Whole
- SM_Gaspods_X_Destroyed
BP_Gaspods_X_Whole cannot be found inside BP_Gaspods_X_Destroyed which ensures they will not conflict.
So far the only blueprints that utilize naming conventions are our Foliage Placement Tools, but you should be following these conventions even if you are not planning on using these tools in case there are some updates in the future.
Checklist #
- Static Mesh has Simple Collision
- Physics Asset root body is set to Kinematic
- Optional: Physics Asset root body has Collision Disabled
- Physics Asset bodies have Gravity Disabled
- Physics Asset constraints properties are set
- Optional: Physics Asset constraints have SLERP Angular Drive for ‘spring’ effect
- Asset names cannot be found inside one another