LineTraceComponent broken on 4.14

Hello

I have tried pretty much every single thing so far and nothing i have done has worked. So

To give some context, Im performing a trace that comes from two sockets on the player weapon. i get these locations each tick and then use these for the trace. using draw debug line i can see that they are being displayed and updated correctly

However when using LineTraceComponent the results arent constant, and the trace registers hit events even when it hasnt hit anything. Here is a video showing clearly the issue as well the code im using (Im using the K2 function since it draws the trace better, using the standard LineTraceComponent function still gives the same issue )

if (Pawn->GetMesh()->K2_LineTraceComponent(TraceStart, TraceEnd, true, true, Hit, Norm,F))

Hey alvarofer0020-

If you’re able to reproduce this behavior in a new project, can you provide the setup steps to help me test the issue? How and where are you using the line of code above? Please provide as much information as possible to help me reproduce this behavior locally.

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

It appears that the project you provided is using the MeleeTrace plugin, are you able to reproduce the issue without the use of the plugin? Additionally, the provided project does not have a Source folder and does not appear to use code, is the AMeleeWeapon::Tick() code part of the plugin?

Sorry my bad, here is the proper link

any updates?

Hey Alvarofer0020-

Thank you for the sample project. I have reproduced this issue and logged a report for it here Unreal Engine Issues and Bug Tracker (UE-40025) . You can track the report’s status as the issue is reviewed by our development staff. Please be aware that this issue may not be prioritized or fixed soon.

Cheers