Line Trace with Level Geometry not Working

I am working on a 2d platformer based off of the Side Scroller Template project and am trying to implement a wall slide mechanic but am having some trouble getting my line trace to work properly. My goal is to line trace from the Character’s position in the direction of inputted movement (either left or right) to see if a wall is in range so the Character can start wall sliding. However, I cannot seem to get my line trace detect a “hit” with any of the geometry I’ve tested this with (primitive geometry brushes, or basic static mesh shapes).

If anyone has any idea what the problem is and could provide any insight on what I’m doing wrong it would be extremely helpful. Here is the code I have to perform the line trace, (located in the MoveRight(float Value) function of my “PlatformerCharacter” class):

 // Use Line Trace to check if player is touching a wall
    		const FName TraceTag("Wall Trace");
    		FCollisionQueryParams TraceParams = FCollisionQueryParams(TraceTag, true, this);
    		TraceParams.bTraceComplex = true;
    		TraceParams.bTraceAsyncScene = true;
    		TraceParams.bReturnPhysicalMaterial = false;
    		TraceParams.AddIgnoredActor(this);
    
    		// Declare and initialize struct to receive hit info
    		FHitResult HitResult(ForceInit);
    
    		// Calculate start and end points of line trace
    		FVector Start = GetActorLocation();
    		FVector End = Start;
    		float LineTraceLength = CapsuleComponent.Get()->GetScaledCapsuleRadius() + 50.0f; // want trace to be a little longer than capsule width to ensure wall is properly detected
    		if (Value > 0.0f)
    		{
    			// if player is inputting right movement check right (-y)
    			Start.Y -= LineTraceLength;
    		}
    		else if (Value < 0.0f)
    		{
    			// if player is inputting left movement check left (+y)
    			Start.Y += LineTraceLength;
    		}
    
    		DrawDebugLine(GetWorld(), Start, End, FColor::Blue, false, -1.0f, 1.0f, 5.0f);
    
    		// Fire the line trace
    		if (GetWorld()->LineTraceSingle(HitResult, Start, End, ECC_WorldStatic, TraceParams))
    		{
    			GEngine->AddOnScreenDebugMessage(-1, 2.0f, FColor::Blue, TEXT("Hit Found"));
    		}

So I just tested this with another instance of PlatformerCharacter rather than a wall and it detected the collision, so it’s just an issue with detecting a line hit with level geometry.

Start.Y is in world coordinates (because GetActorLocation returns world coordinate). ONLY if your actor is looking in the direction of the X axis, moving in the Y component indeed represents right or left. Also, you should be manipulating the End of the trace, because tracing outward from inside of geometry can fail to register a hit, at least Im pretty sure I got screwed over by that. So you should really be doing this:

             if (Value > 0.0f)
             {
                 // if player is inputting right movement check right (-y)
                 End += GetActorRightVector() * LineTraceLength; //Right vector is a unit vector, so multiply it by TraceLength. Also note that we're adding here, since its the Right vector
             }
             else if (Value < 0.0f)
             {
                 // if player is inputting left movement check left (+y) 
                 End -= GetActorRightVector() * LineTraceLength;
             }

//////////////// In the end, it can be simplified to this:

             End += GetActorRightVector() * LineTraceLength * FMath::Sign(Value);

On another note, you should do an early return when Value==0 so that you dont do traces unnecesarily.
Also, you can declare TraceParameters in your .h file and initialize it somewhere else (like the constructor, or BeginPlay) so you dont make new one each time you get input.