Hello I am using UE 4.15.2. I have a first person C++ template project with an added Tick event. The code below is used in the tick event. When using a single line trace or a sphere in SweepSingleByChannel, it works correctly (code below)
FHitResult HitResult2(ForceInit);
FCollisionQueryParams TraceParams(FName(TEXT("DashTrace")), true, this);
TraceParams.bTraceComplex = true;
GetWorld()->DebugDrawTraceTag = FName(TEXT("DashTrace"));
if (GetWorld()->SweepSingleByChannel(HitResult2, GetActorLocation(), GetActorLocation()+GetActorForwardVector()*100.0f, FQuat(), ECollisionChannel::ECC_Visibility, FCollisionShape::MakeSphere(55.0f), TraceParams))
{
GEngine->AddOnScreenDebugMessage(-1, 5.f, FColor::Red, TEXT("TRACE HIT"));
}
However, if the shape is made a capsule instead, the editor will crash when you attempt to play the game.
FHitResult HitResult2(ForceInit);
FCollisionQueryParams TraceParams(FName(TEXT("DashTrace")), true, this);
TraceParams.bTraceComplex = true;
GetWorld()->DebugDrawTraceTag = FName(TEXT("DashTrace"));
if (GetWorld()->SweepSingleByChannel(HitResult2, GetActorLocation(), GetActorLocation()+GetActorForwardVector()*100.0f, FQuat(), ECollisionChannel::ECC_Visibility, FCollisionShape::MakeCapsule(55.0f, 96.0f), TraceParams))
{
GEngine->AddOnScreenDebugMessage(-1, 5.f, FColor::Red, TEXT("TRACE HIT"));
}
I cannot figure out if this is an engine bug or what. Any ideas? I would like to do a capsule traceā¦