Can I instantiate volumes through code?
Is there any way to create a volume (specifically a post-effects volume) through code, preferably Blueprints?
I have a class of moving actor that affects the player's vision via post-effects the closer that they get to it. As such I need a post-effects volume to remain attached to these actors as they move. The problem is that I can see no way to add a volume as a component. I can parent a volume to an actor in the editor just fine, but I need to be able to do this at runtime. If I try to create a composited Blueprint out of the hand-created actor/volume hybrid, it just detaches the volume.
If there's another way to achieve this, I'd also be interested in hearing. My current backup plan is to interpolate the effects directly onto the player's camera based on distance to any of these actors every tick, but that sounds both painstaking and inefficient.
There are certainly many ways to achieve the effect you're looking for. An easy way would be to create a Post Process Volume and set it to Unbound so it affects the camera no matter where it is. Then in your Level Blueprint (or character blueprint, or moving object's blueprint, etc), turn it on or off depending on whether the player is within a certain range of the moving objects.
But there's more! I just checked our internal build, and the ability to add a Post Process Volume as a component inside a Blueprint is there. It's on it's way! I can't give you a firm date for that, but you should be able to do that soon.
answered Apr 28 '14 at 06:49 PM
i just discovered that this code works:
first you get the uobject that represent PP asset; then you get the factory to construct it; finally you use that factory to create your final actor!
you can use the same code to spawn all others volume related actors, for example:
answered Jan 05 '18 at 11:34 AM
Follow this question
Once you sign in you will be able to subscribe for any updates here