Screen effect when player gets too far

Hello guys! I am working on a horror game. In order to stop the player from wandering too far I want to add a static effect to the screen that fades in the farther away the player goes, and fades out the moment that the player is returning to the specified zone. Any help is appreciated.

Add a post process component to the player class. Adjust the PP to have the effect you want. Set the PP disabled by default.

Create an Actor class. Name it Play Zone. Add a Collision component…say box.
Box collision settings: ignore all, overlap Pawn.

End overlap: Enable character post process.
Begin overlap: Disable Post process.

Add the Play zone to the level. Scale it as needed.


When the player leaves the play zone the PP will be enabled and apply the base effect. You can add an event that triggers a per tick trace to get the distance from zone and adjust the PP settings as needed.

When the player re-enters the zone (begin overlap) the effect is disabled.

2 Likes

Thank you, It works! But can you tell me how to change the effect intensity based on the actor location? I used the film grain effect.

You can Create that effect with a simple UserWidget,too.

Simply create a Widget, that contains only an image, covering the whole Screen (best use a Canvas Panel as base, to get anchor and offset settings).

This image can be tinted… And even set more or less opaque.

Ps.: hate it, when my autocorrection tries to mix german and English :angry:

If you are going to adjust the effect based on “distance” then you need to know how far away the player is from the boundary edge. The optimal approach depends on the Player Zone shape.

If Box or Irregular (convex, concave etc) You’re going to have to do a trace every tick and evaluate the distance. I recommend creating a new collision type for your capsule component and one for the Play Zone.

Project settings → Engine → Collision

New object Channel: Pawn Capsule (default BLOCK)
Change your characters capsule component collision to Pawn Capsule. Make sure all of its settings are the same though. Ignores, overlaps, blocks.

Create Play Zone Object Channel
Object Channel: PlayZone (default IGNORE)

Update your Play zone collision…ignore all, overlap Pawn
Update the character skeletal mesh to Overlap Play Zone
Make sure the pawn capsule collision is ignoring Play Zone.

Your Trace type will be Line Trace for Objects → Play Zone

On End Overlap will now Enable the post process and Set a bool (PZ_OutofBounds).

Event Tick: Branch (PZ_OutofBounds) TRUE: → execute custom function or event.

Custom Func/Event: Line trace for objects (trace distance should sufficient) → On hit → Distance (vector: pawn world location, hit result impact point)

Use this distance to scale your effect.


If Cylinder or Spherical you can use the component radius and the Distance(vector) node on tick.

Radius you can set in the player zone actor on begin play with a custom float var. Do the same with component bounds origin.

Character begin play: get overlapping actors (Player zone) → Get copy [0] → set as a reference var.

On end overlap: Enable the post process and Set bool (PZ_OutofBounds).

Event tick checks bool, executes custom func/event.
Custom func/event: Player Distance = Distance (vector: pawn world location, PZ origin), Minus PZ Radius.

Use this distance to scale your effect.


If per tick is too much you can use modulus to execute every 3rd, or 5th, or 10th etc frames.

Alternatively you can skip tick and distance and do everything based on Exposure Time. So over time outside the boundary the effect is scaled. Use the PP_OutOfBounds[bool] to control the event. Use SetTimer by Event to scale every sec or whatever duration. Don’t forget to manage your timer handle when begin overlap stops the PP effect.

Also, remember to reset everything when you re-enter zone. PP_OutOfBounds[bool], PP settings etc.

Adding to my last post…

If you decide to go with Exposure Time you can simplify and encapsulate a lot of the code.

Instead of adding a Post Process volume to the player you could switch and scale the settings of the levels. You’d create an Actor class (BP_LevelPP). This actor has a Post Process volume that will act as the Levels PP.

Create 3 Post Processing Settings variables.

  • IB_Settings: default world PP settings.
  • OOB_default_Settings: Base settings for when the player first steps OOB.
  • OOB_Settings: mirrors the defaults.

Ensure ALL have Infinite Extent Set as true.


Drag this Actor into the level and delete the Levels PP if you have one.


Play Zone will handle triggering In and Out of Bounds events.


This is as simple as I can get it off the top of my head.

Hello again! Thank you for your cooperation. I have a few problems. I tried the first method. It didn’t work. Here is a screenshot.


Then I tried the second method. I couldn’t get it to work either.
This is the BP_LevelPP:

And this is PlayZone:

Here are the collision settings for playzone:

These are for the third person bp capsule component:

This is what I got working so far:
I don’t know why but I works only once:

Also, how do I change the skeletal mesh to overlap play zone? Maybe it’s because of this? If it’s not too much to ask, can I see your project? Maybe I will figure out what I’m doing wrong.

Second method should work pretty straight forward.

Select your skeletal mesh → collision (Obj type PAWN). Presets should be Custom. Then set play Zone to Over lap.

Capsule should ignore play zone. Only want the effect to trigger on overlap of the skeletal mesh.

I’ll run through mine first thing in the morning and see I forgot something. 3am here.

Sure! Thanks for helping me. I’ll wait

I think I figure out what your issue is. Forgot to note that you need to enable overlaps on the skeletal mesh.

Collision → Generate Overlap Events [true]

Working demo: Play zone out of bounds - YouTube

If you need a better vid, more of a walkthrough let me know.