You could do this using CanvasRenderTarget2D. I’ll show you a basic version below which should give you some ideas.
- Make a new Blueprint Class, and choose CanvasRenderTarget2D as the parents class. Mine is named BP_CanvasRenderTarget
- In that Blueprint, add the below nodes. Add two float variables, Width and Height. And add a float array with 20 elements, changing the amount of elementscontrols the ‘granularity’ of the graph.
-
Make a new material, mine is called ScannerScreenMaterial. In it, add a texture parameter named TargetTexture. Give it the default texture, and plug it into Base Color.
-
Make a new Blueprint actor. Mine just has a cube mesh (Named “Scanner”) that I will apply the above graph material to.
Also add a material instance dynamic variable, called ScannerMaterial. Add two float arrays, once called Distances, and one called ShiftedDistances, make sure both have 20 elements. Also add an Actor variable, and make it editable, this actor will be the actor whose distance to you will be checking. You need to set this from somewhere that makes sense for you project, for me for testing I just used a random object in the scene, and set it in the details panel in the level.
Construction script:
The Parent material, is the material you made in the previous step.
Add the above on begin play. The Canvas Render target class should be the BP you made in the first step. The time on the function will control how often the graph updates.
Then create a custom event that matches the name in the time, “UpdateScan”. And set up the below:
Note that you will need to set a max and min distance that makes sense for your usage.
Example working below. I was using that cube as the target actor:
Animated: Imgur: The magic of the Internet




