I Use SphereTraceSingleForObjects to check that my character can stand up and i use this code
bool AFirstPersonPlayer::CanStandUp()
{
const FVector Start = GetCapsuleComponent()->GetComponentLocation();
const FVector End = Start + FVector(0, 0, TraceHalfHeight);
FHitResult HitResult;
TArray<AActor*> IgnoresActors;
TArray<TEnumAsByte<EObjectTypeQuery>> ObjectTypesArray;
ObjectTypesArray.Reserve(1);
ObjectTypesArray.Add(UEngineTypes::ConvertToObjectType(ECC_WorldStatic));
bool bHit = UKismetSystemLibrary::SphereTraceSingleForObjects(
GetWorld(),
Start, End,
TraceRadius, ObjectTypesArray,
false, IgnoresActors,
EDrawDebugTrace::ForDuration, HitResult, true
);
UE_LOG(LogTemp, Warning, TEXT("bHit is %s"), HitResult.bBlockingHit);
return !bHit;
}
and this always returns null, so editor crashes. But if i don’t use this function return value debug drawing is okay. What i do wrong?