Is there a way to say 'any actor'?

AActor* AnyActor = ???
if (PressurePlate->IsOverlappingActor(AnyActor))
{

More specifically, is there a way to have ‘AnyActor’ here represent literally any actor in the world?

I want this trigger volume named PressurePlate to trigger when ANY actor enters it, but I’m having trouble figuring out how to say “any actor”.

Hey,

might wanna try something along these lines https://docs.unrealengine.com/en-us/Engine/Blueprints/QuickStart/5
OnComponentBeginOverlap call your function that will check the type of the Actor that is overlapping.

Alternatively you can try to set the collision preset for your pressure plate to only detect overlap for Actors, see Collision Overview | Unreal Engine Documentation

Hope it helps.

Ah I see, well that shouldn’t cause you that much trouble.

Click onto your Pressure plate and find OnComponentBeginOverlap (should have big green + next to it). Click on that plus and this should add OnComponentBeginOverlap method to the object Blueprint. From there you can drop any method from your C++ component attached to Pressure Plate that is marked as BlueprintCallable.

I assume this won’t give you definite answer, but hopefully will set you on the path, so at least you will know what to look for. If you have any questions, I’ll do my best to try to answer (unfortunately I can’t access UE at the moment to offer you image guide)

Many thanks for your reply ex3me, but I’m not sure how to translate either of those links into an answer. I’m absolute beginner with c++ and Unreal, what I’m trying to do is just a tiny part of a challenge I’ve been given during a course/lesson.

I’m more or less looking for a method to say “Any Actor”, literally any actor in the world, so I can say “Hey trigger volume, trigger when an actor enters you. Any actor.”

If no such method exists, I’d be surprised but I would understand.

You can use this method: http://api.unrealengine.com/INT/API/Runtime/Engine/GameFramework/AActor/GetOverlappingActors/1/index.html

If the array that you pass to the method is not empty, then there is at least one overlapping actor and you can proceed.

However, if you want to watch for every overlap continuously, using this method is quite heavy on the performance side. In this case, it is better to subscribe to the ActorOverlap event. Here you can find how to do it in C++.

I received an e-mail about your reply to my answer but for some reason I cannot see it.

Basically, what you need to do is this:

TArray <AActor*> result;
PressurePlate->GetOverlappingActors(result);
if (result.Num() > 0)
{
    // do the rest
}

Ah, the .Num() function is very helpful, thank you!