Toggle actor component visibility from player blueprint

Hi there, What I am trying to achieve (and failing to do so) is to toggle the visibility of an actors component when its overlapping a capsule collider component attached to the player (which is essentially a pickup area for items) Now normally if there was just one of these actors I would directly do it, but because there are multiple of the type it will turn off all of them doing it that way.

You can see here in the picture that I have blue ‘spikes’ coming out of those spheres, the spheres are essentially collectables and I would only like to have it visible when they are inside that capsule, you can see one in the distance which is lit aswell even though it’s not in the ‘pickup area’.

Any help with this would be much appreciated.

Thanks.

Hi Recker,

I believe i was able to successfully recreate your desired set up in a test map. This is the configuration i used.

When the player pawn overlaps the actor (in this case the sphere) the BeginOverlap event fires and sets the component blue spike to visible. The when the player pawn stops overlapping the sphere, The EndOverlap event fires setting the blue spike to hidden. The event Begin play just sets the blue spike to hidden when the game is first launched.

9418-bp2.jpg

The highlighted box must be checked or collisions with the player pawn will not fire the overlap event.

I hope this helps. If i missed something please don’t hesitate to let me know.

EDIT: Scratch that, I fixed that by myself, but now another issue has come up, obviously those spheres are item placeholders, as such when the use key is pressed it destroys the actor, which in turn makes it so there is no overlap anymore even if there are more than one of those actors in the area, that is affecting the visibility toggle…

As you can see here, I did have a third sphere but it has just been destroyed, and now the other blue spikes have had their visibilities turned off also.

Ah ok i was able to fix that problem by changing the object type in the collision settings to pawn.

Cool thank you very much, that works as intended now.

Just as an extra to have that as a fading effect rather than a snap to on or off, would that be done via some material work or is there an actor/component opacity function?

I was able to make the spike fade in and out again however its a bit more complicated than the first issue.

Basically you create a timeline that changes the value of a float over time. My example made the float value go from 0 to 1 in 0.5 seconds. The float value will be the opacity of the spike material.

Next you make a material parameter collection and give it a name, add a scalar parameter and make its default value 0. Name it something like Opacity Param.

Now set the spike material to translucent if you haven’t already, add a “Collection Parameter” node, set Collection to the material parameter collection you made earlier and select the scalar parameter in the parameter name drop down box (Opacity Param).

Go back to the pickup blueprint and add a “Set Scalar Parameter Value”, set the Collection to the material parameter collection and select the parameter.

Lastly connect the float output from the timeline node to the float input on the set scalar parameter.

Sorry if I left some things out but hopefully these screenshots will help you if you need it. This blueprint has everything discussed earlier included with it. Please keep in mind i’m no professional and my method is most probably not the best or most efficient way to do it but it gets the job done. That being said good luck!

Cool thank you very much, it works wonderfully.