Hey
Yes i have been able to reproduce the behavior in a new project . Also here is a link to a example project using only the starter content. hold your left mouse button and move arround. you will see that the trace “hits” the character even if the trace hasnt hit anything
Here is the complete sample of the code im using (this is being done on Tick)
void AMeleeWeapon::Tick(float DeltaSeconds)
{
Super::Tick(DeltaSeconds);
FVector TraceStart;
FVector TraceEnd;
int i;
FHitResult HitData(ForceInit);
FCollisionQueryParams Params;
/* if we should trace*/
if (bTrace)
{
StartSockEnd = Mesh->GetSocketLocation(SocketStartName);
EndSockEnd = Mesh->GetSocketLocation(SocketEndName);
for (i = 0; i<TracesPerSwing; i++)
{
TraceStart = FMath::Lerp(StartSockEnd, EndSockEnd, i / TracesPerSwing);
TraceEnd = FMath::Lerp(LastFrameStartSockEnd, LastFrameEndSockEnd, i / TracesPerSwing);
if (bDrawTraces)
{
DrawDebugLine(Instigator->GetWorld(), TraceStart, TraceEnd, FColor::Red, false, 5, 0, 2.0);
}
for (FConstPawnIterator Iterator = GetWorld()->GetPawnIterator(); Iterator; ++Iterator)
{
ACharacter* Pawn = Cast<ACharacter>(*Iterator);
if (Pawn && Pawn != WeaponOwner) //
{
if (WeaponOwner->GetDistanceTo(Pawn) <= MeleeRadius)
{
if (Pawn->GetMesh()->LineTraceComponent(HitData, TraceStart, TraceEnd, Params))
{
if (CheckHurtEnemies(Pawn) == true)
{
OnHit(HitData);
}
}
}
}
}
}
LastFrameStartSockEnd = StartSockEnd;
LastFrameEndSockEnd = EndSockEnd;
}
}
(LastFrameStartSockEnd, LastFrameEndSockEnd,StartSockEnd and EndSockEnd are vectors i declared in the actor header, Mesh is a skeletal mesh component attached to the player hand )
Basically. Once bTrace is true, i start by setting the StartSockEnd & EndSockEnd vectors to the location of a socket in the Mesh component. Then i perform a loop based on a float value ( TracesPerSwing ) Inside that loop i interpolate the current trace location & the previous frame trace location using lerp so the current trace gets done with both locations so it doesnt miss any spaces if the frame rate drops
Then i proceed to iterate trough all of the pawns in the world, and grab only the ones close to the weapon owner <= melee radius ( 800 units ) , Finally if the pawn we have got trough the iterator is not the owner i perform the LineTraceComponent against “that” character mesh. and At that point is where the trace goes crazy
However the vectors and locations are correct, since if you use DrawDebugLine on both TraceStart & TraceEnd they display correctly. only using them on LineTraceComponent causes the issue