Ue4 Shield Tutorial

Setup

The shield uses 2 Sphere's for it's main effect, and instantiates a third to run the 'on-hit' effect. You could probably combine the materials for the static shield effect but back when I created this I wanted them separate. 

Every time the shield gets hit:

1) get the hit location

2) Spawn the 'Hit' sphere

3) Have the spawned sphere use the hit location to run the shield hit effect, and whatever else.

Main Outer Look Shader (just the shield 'is turned on' effect)

Main Outer Look Shader (just the shield 'is turned on' effect)


This shader runs the depth logic that makes the shield look like it's cutting through geometry as you walk around with it.

This shader runs the depth logic that makes the shield look like it's cutting through geometry as you walk around with it.


This shader runs the 'On-Hit' effect. The shader is driven through a few variables to get the 'ring' to grow over time, then fade out. Whenever the shield gets hit, I spawn another sphere (or you could use a particle system) and it just lerps these values over time.

This shader runs the 'On-Hit' effect. The shader is driven through a few variables to get the 'ring' to grow over time, then fade out. Whenever the shield gets hit, I spawn another sphere (or you could use a particle system) and it just lerps these values over time.


Here is the logic on the sphere that runs the hit effect. Basically it just fires a function that runs the effect driven by timelines. I believe in this iteration, 'Effect In A' is the ring effect, and 'Effect in B' is the refraction + distortion.

Here is the logic on the sphere that runs the hit effect. Basically it just fires a function that runs the effect driven by timelines. I believe in this iteration, 'Effect In A' is the ring effect, and 'Effect in B' is the refraction + distortion.


This runs the Ring growing over time.

This runs the Ring growing over time.


And this runs the refraction + distortion.

And this runs the refraction + distortion.


Finally this is the actual shield BP Logic. The shield just has a 2 static mesh (sphere) components and a sphere collision component. Pretty simple stuff.

Finally this is the actual shield BP Logic. The shield just has a 2 static mesh (sphere) components and a sphere collision component. Pretty simple stuff.