Raycasting not working from surface of mesh component inwards

Hello!

I’ve been having a problem with raytracing that I’m hoping someone might know more about.

For a game mechanic, I am raycasting from a point in a rope to a point on the line between the points before and after it (as demonstrated in the below image), to check if the point in the rope should move away from an actor it has attached to. I have set up debug lines and spheres to visualize this:

(the lines are green when the point should move, and red if it should not, and the point it is raycasting to is the gold sphere)

However, it seems that because the points are created on the surface of actors (they are generated through raycasting between two points to determine if there is a collision), raycasting will not work consistently, shown by the lines being green when they should be red:

(you’ll notice the end point of the trace is inside of the actor)

My code for the method to check this is as follows:

bool ASilkPoint::CheckMove(FVector movePointLoc, float desiredFreeDistance)
{
	// Perform trace to retrieve hit info
	FCollisionQueryParams TraceParams(FName(TEXT("RibbonTrace")), true, this);
	TraceParams.bTraceAsyncScene = false;
	TraceParams.bReturnPhysicalMaterial = true;
	TraceParams.bFindInitialOverlaps = true;
	TraceParams.bTraceComplex = true;

	FHitResult Hit(ForceInit);

	FVector StartTrace = GetActorLocation();
	FVector EndTrace = movePointLoc;

	GetWorld()->LineTraceSingleByChannel(Hit, StartTrace, EndTrace, COLLISION_SILK, TraceParams);

	float distance = FVector::Dist(Hit.TraceStart, Hit.Location);

	if ((Hit.bBlockingHit && (distance <= desiredFreeDistance)))
	{
		DrawDebugLine(GetWorld(), StartTrace, EndTrace, FColor(255, 0, 0), false, -1, 0, 12.333);
			return false;
	}
	else if (Hit.bStartPenetrating && Hit.PenetrationDepth > FVector::Dist(StartTrace, EndTrace))
	{
		DrawDebugLine(GetWorld(), StartTrace, EndTrace, FColor(0, 0, 255), false, -1, 0, 12.333);
		UE_LOG(LogTemp, Warning, TEXT("Penetrating!!!!"));
		return false;
	}
	else if (Hit.bStartPenetrating)
	{
		return false;
	}
	else if (Hit.bBlockingHit)
	{
		return false;
	}
	else
	{
		DrawDebugLine(GetWorld(),StartTrace,EndTrace,FColor(0, 255, 0),false, -1, 0,12.333);
		return true;
	}
}

The third and fourth else if statements were put in merely to see if the raytrace was registering any hit at all or if it registered that it started inside of the object. If the method returns false, then the method that calls this one will draw red lines instead of green. Also, COLLISION_SILK is defined as ECC_MAX, as i wanted to eliminate the possibility of the problem being my trace channel, before i reduce it to another, less performance-heavy channel.

Anyone have any ideas on why this doesn’t work?

Thanks in advance!!