Can't hit things properly

I have tested this, and yes something is wrong with the End of the Line trace, but the thing is, I don’t know what is wrong, I tried and Something seems to be wrong with the Location to, here is my code

bool AGun::GunTrace(FHitResult& HitResult, FVector& ShotDirection)
	AController* OwnerController = GetOwnerController();
	if (OwnerController == nullptr)
		return false;
	FVector Location;
	FRotator Rotation;
	FVector End = Location + Rotation.Vector() * MaxRange;
	OwnerController->GetPlayerViewPoint(Location, Rotation);
	ShotDirection = -Rotation.Vector();
	FCollisionQueryParams Params;
	DrawDebugLine(GetWorld(), Location, End, FColor::Red, true);
	DrawDebugCamera(GetWorld(), Location, Rotation, 90, 2, FColor::Red, true);
	return GetWorld()->LineTraceSingleByChannel(HitResult, Location, End, ECC_GameTraceChannel1, Params);

Debug Lines are from me testing

I actually had to just define End in a different place further down

This topic was automatically closed 24 hours after the last reply. New replies are no longer allowed.