I’m new(ish) to ue5 and I tend to make very large maps. When a player falls into a lake and/or if a player walks off the map, the game freezes. I use blueprints. How could I change this behavior, e.g., bringing the player back to the origin instead. I can’t find documentation on this problem, for some reason. Maybe I don’t know the right keywords?
You can add blocking volumes to enclose the map.
You could create an Actor class (BP) that has a Box collision. Set the collision setting to Ignore all, Overlap Pawn. Tick “Generate Overlap Events”.
Scroll down and find the events. Click the + for “On Component End Overlap”.
Open the event Graph and find the event. Apply the following.
Place the actor in the center of the map, While selected go to details, click on the collision component. Scale it to fully surround your map. I recommend using the transform (Scale) in the details panel.
Save and test.
When a PAWN exits the collision (ending overlap) the pawn will be teleported to world location (0,0,0).
I will probably use this technique, but I’m wondering is there a way to modify the default behavior and/or even gain access or find documentation on the default behavior. Like, I didn’t tell it to pause the game when the player stepped out of bounds, something was set by default, and I’d like to mess with it. Any thoughts?
Gonna use this but any thoughts on how to trace down the default behavior?
What I was looking for was the killZ volume: Volumes Reference | Unreal Engine 4.27 Documentation.
You can use this if the intent is to “Destroy” the actor.
Performance wise you wouldn’t use a KillZ. You’d use another actor/code to move the actor and re-use it.
Destroying actors is costly, that’s why most games “re-use” actors via object pooling, or simple script → teleport, reset, re-possess etc.
I guess what I’m saying is that KillZ was turned on by default, and that’s why the game got stuck when my player went into certain areas. I just made a switch that turns on when they exceed certain bounds that teleports them back to start.