I got a problem with GetOverlappingActors and how to use the class filter. What do I have to write ? I try with the class type ( AHumanCharacter ), an object of this class ( AHumanCharacter* Human; ) but nothing work.
Can you help me please ?
Here my function :
void UHealComponent::Heal(float HealValue)
{
AHumanCharacter* HumanCharacter;
TArray<AActor*> HumansInZone;
GetOverlappingActors(HumansInZone);
for (auto Human : HumansInZone)
{
}
}
Hi, I know this post is old, but I have a problem, I manage to follow your steps and so far it works pretty well, I can do the GetOverlappingActors with the filter
My problem starts here (I´m coping Vins V code and names just to give and example of my problem):
for (auto Human : HumansInZone)
{
}
Inside the for loop I want to send a Message to Human that is understood by the class AHumanCharacter, but Human is of type AActor* so it doesnt understand the message.
From what I have read I think I should be casting Human to AHumanCharacter, but when I do that then in run time the engine crashes. Maybe I´m casting it wrong???
I´m pretty sure the filter works because i´ve tried using Human.Destroy(); and it works just fine only destroying the actors that correspond to AHumanCharacter
Hi, thank you for the response, I spent the next day trying to solve it and it was my bad, I was messing up something else that ended up in a null pointer, thank you for the quick response
Using Visual Studio 2017 14.16.27023 toolchain (C:\Program Files (x86)\Microsoft Visual Studio\2017\Community\VC\Tools\MSVC\14.16.27023) and Windows 10.0.17763.0 SDK (C:\Program Files (x86)\Windows Kits\10).
Building 4 actions with 8 processes...
[1/4] FlagObjective.cpp
C:\UE4_forks\Unreal_Projects\VRFracture\Source\VRFracture\FlagObjective.cpp(51) : error C2664: 'void AActor::GetOverlappingActors(TSet<AActor *,DefaultKeyFuncs<InElementType,false>,FDefaultSetAllocator> &,TSubclassOf<AActor>) const'?: impossible de convertir l'argument 2 de 'TSubclassOf<ACharacter>' en 'TSubclassOf<AActor>'
with
InElementType=AActor *
]
C:\UE4_forks\Unreal_Projects\VRFracture\Source\VRFracture\FlagObjective.cpp(51): note: Aucun op?rateur de conversion d?finie par l'utilisateur disponible qui puisse effectuer cette conversion, ou l'op?rateur ne peut pas ?tre appel?