Niagara Foliage Gun

A UE4 Niagara foliage gun and foliage bomb: GPU mesh particles, Blueprint-spawned tree collisions, and custom collisions that keep growth on flat ground.

Niagara setup

Niagara foliage gun system
Niagara foliage gun system

There are two variations of this effect:

The foliage gun spawns a random amount of grass, flowering plants and sometimes a tree. All of these are GPU mesh particles to keep it performance friendly.

All of the meshes scale up over time and rotate, with a random size and rotation to keep the look natural.

Grass and flowering plants have 3 different meshes. I select a random mesh using the Particle Visibility Tag module, driven by a random int attribute.

Grass and flowering plants:

Random mesh selection
Random mesh selection

Same with the trees: 2 different meshes keep things natural.

Tree mesh setup
Tree mesh setup

Blueprint setup

Blueprint collision setup
Blueprint collision setup

One interesting challenge was spawning tree collisions. Whenever a tree is spawned (randomly, every few hits), Niagara sends the info to a Blueprint. The Blueprint takes the location of that tree particle and spawns a capsule collider there.

To spawn the foliage, the Blueprint takes the hit location and spawns the Niagara system there.

Niagara collision fix
Niagara collision fix

Niagara foliage bomb

Setting up the grenade was straightforward: another projectile in the First Person Blueprint, fired with right click.

Foliage bomb projectile
Foliage bomb projectile

The grenade is spawned as a projectile. After 2.5 seconds it spawns the grenade Niagara system, a camera shake, and a radial impulse that pushes surrounding physics objects.

Foliage bomb impulse
Foliage bomb impulse

The impulse is added with this Blueprint:

Impulse Blueprint
Impulse Blueprint

Another small challenge was spawning particles only on flat ground. This was solved with custom collisions.

Custom collisions
Custom collisions

This effect was retweeted by Unreal Engine's official Twitter account.

Retweet by Unreal Engine
Retweet by Unreal Engine