Codul someone explain to me how I can get a mesh component in my Class BP to pulse a certain color over its textures…kinda like pulsing glow? And also how its possible to trigger it on and off via nn overlap component?
Thanks guys.
Codul someone explain to me how I can get a mesh component in my Class BP to pulse a certain color over its textures…kinda like pulsing glow? And also how its possible to trigger it on and off via nn overlap component?
Thanks guys.
There are a few different ways to do this, depending on your specific requirements.
Will there be more than one instance of this BP visible in a level, and if so, is it important that their pulsing states are independent from one another?
Is it important that the pulsing state starts and finishes with a graceful fade-in/out, or would an abrupt transition from pulsing to non-pulsing (and vice-versa) be acceptable?
Thanks for replying. There may be only one or two of these BPs in the level. Itll be attached to the character mainly. And yes. Itd be nice if it could fae in and out even if it was at a rapid pace.
So no independence is not important…but yes id like to fade the glow. …whatever you can tell me will be great.
OK, so one or two means more than one, and fade means… yeah, fully flexible setup. It involves quite a few bits and pieces.
The first thing is the material setup (see below). Nothing special, except that the node named EmitColor is a VectorParameter node. This means that it can be changed dynamically at runtime. Important for pulsing stuff, obviously. The rest of the material graph isn’t important, so do what you like/need there.
With the material done, you create a new BP using Actor as base class. Add a Box Shape as root component, so we can detect overlap events. Then add a static mesh of some sort, and apply the new material to it in the Rendering settings:
That’s the simple part. Now for the juicier bits.
I’ll let you pick most of it apart yourself, but some key points are:
The construction script creates a Dynamic Material Instance, which gives the mesh a unique copy of the material. That way we can change its EmitColor parameter without affecting other instances using the same material. The material instance produced is stored in TheCurrentMaterial variable for easy referencing in the event graph later.
I added an editable PulseSpeed variable here, hooked up to a Custom Time Dilation setter, which makes it easy to adjust the pulsing speed on a per-instance basis. Just a handy feature to have.
The event graph then runs a timeline when BeginOverlap is triggered. The timeline feeds a color value to the SetVectorParameterValue which changes the EmitColor over time. On its way to the material parameter, the value is multiplied by another editable variable (GlowMultiplier) which simply provides a way to adjust the strength of the effect.
To avoid having the effect cut out instantly as soon as we step out of the box trigger, which would look ugly if it’s a slow pulse, the timeline logic does some trickery with the Finished execution pin. In short, it keeps playing the timeline over and over until EndOverlap happens, but it always plays the full curve rather than cutting off the very moment the overlap ends. This is managed via the IsStillOverlapped boolean variable. To avoid getting all my wires crossed, I used a local custom event here (StartOverAgain) but this isn’t strictly necessary. If it seems confusing, you could simply hook up the True pin from the Branch node directly to the PlayFromStart pin in the PulseTimeLine node.
So, yeah, that should cover it. With this setup, you can have as many instances as you like, and they will all operate independently from each other.
Good luck!
All of this is incredible info. Thanks a million. Ill be putting this together asap. amazing help. Thank you greatly.