Are there Kill X and Kill Y other than Kill Z?

I’m creating a project on a large scale in UE4.
If you move more than a certain distance from the spawn point, the pawns and actors will disappear automatically.
We are waiting for an answer from someone who has some insight.
Thank you.

If you need a circular area you can do a periodical check (pleas don’t do it in tick) to check if the vector length between your player world location and the circle center (works even if it’s not 0,0,0) is larger than your desired radius.

If you need a square area you have to check each axys individually, for example:

100m x 100m square with center at 0,0,0

You can use this condition to kill the player:
If(Abs(PlayerWorldLocation.X) > 5000.0f || Abs(PlayerWorldLocation.Y) > 5000.0f)

(You can use ABS() to get the value without the sign, but you can do this only if the center is at 0, if you need a custom center you have to do four checks)

1 Like

Thank you for the fast reply.
It was a very easy-to-understand explanation, but my explanation was insufficient.

I would like you to explain whether there are kills X and Y other than kill Z, and the phenomenon that the actors and pawns disappear when passing through certain coordinates, leaving only the debug camera.

Sorry for the many corrections.
Thank you.

You’re welcome, I’m sorry I didn’t understand your question,
In a nutshell, no, there are no KillX and KillY, because as you can imagine KillZ is a single value on the Z axis that you are going to reach because of gravity if you fall, and it’s made to kill actors falling out of the world.

You can recreate something similar very easily, but you need C++ (because the “FellOutOfWorld()” function is not blueprintcallable.

Create a C++ class that inherits from PhysicsVolume (Because you need ActorEnteredVolume):

In the .h file create override the “ActorEnteredVolume()” function:

virtual void ActorEnteredVolume(class AActor* Other) override;

In the .cpp file add in the header:

#include "GameFramework/DamageType.h"

And define the function

void AMyPhysicsVolume::ActorEnteredVolume(class AActor* Other)
{
	Super::ActorEnteredVolume(Other);

    const UDamageType* DamageType = GetDefault<UDamageType>();
    Other->FellOutOfWorld(*DamageType);
}

(Obviously, change “AMyPhysicsVolume” to the name of your class)

Now you can place four volumes in the world (resize them to your desired size) and every actor that touches them gets instantly killed as it fell out of the world. (It works, I tested it before posting it :rofl:)

2 Likes

Thank you for your reply:)
Best of all, my thoughts are conveyed!
By the way, I have one request.
I’d like to confirm it, so please show me the .cpp file and .h file you created respectively.
Thank you for responding to repeated requests.

They are in a plugin folder so the API name should vary:

MyPhysicsVolume.h (352 Bytes)
MyPhysicsVolume.cpp (331 Bytes)

(Please upvote my answers if they helped you solve your issue)

Have a nice day

2 Likes