I am using the linetrace to check for a particular object. (Not using AActor)

I am trying to check if the linetrace only hit a particular object if it is true then play a debug message. I am using the boolean that the line trace uses to reference with a particular object that was hit, rather then using just checking to see if the linetrace hit, or not. In order to check the to see if the object was hit would I have to use a boxcomponent or sphere component? Do I have to write an OnHitFunction or an OnComponentBeginOverlapFunction to check to see if the Linetrace collided with the overlap? Also for some reason if I try to call a Destroy Function within the Object itself then call the function using the Linetrace the engine crashes. I feel like I am close to the truth somewhere.

  void ACharacter::Linetrace()
    {
    	//Here is the linetrace.
    	FHitResult* HitResult = new FHitResult();
    	FHitResult Hit;
    	const float LineTraceLength = 20000.0f;
    	const FVector StartTrace = FirstPersonCameraComponent->GetComponentLocation();
    	const FVector EndTrace = (FirstPersonCameraComponent->GetForwardVector() * WeaponRange);
    	FCollisionQueryParams QueryParams = FCollisionQueryParams(SCENE_QUERY_STAT(WeaponTrace), 
                                                                                                                                                                   false, this);
    	FCollisionQueryParams* TraceParams = new FCollisionQueryParams();
    	//Here is the linetrace itself. 
    	if (GetWorld()->LineTraceSingleByChannel(Hit, StartTrace, EndTrace, ECC_Visibility, QueryParams))
    	{
    		if (Particles)
    		{
    			UGameplayStatics::SpawnEmitterAtLocation(GetWorld(), ImpactParticles, 
                                                                                                     FTransform(Hit.Normal.Rotation(), Hit.EndPoint));
    		}
    	}

    	 bHit = GetWorld()->LineTraceSingleByChannel(*HitResult, StartTrace, EndTrace, ECC_Visibility,   
                                                                                                                                                *TraceParams);                                                                                                
    	 AAParticularObject* Object = Cast<AAParticularObject>(GetWorld());
    	//I am trying to check to see if the linetrace detects the character.
    	if (bHit /* = Object */ ) //Here is the condition. I know the condition is not correct this is just an example.
    	{	
    		//I know you have to create a boolean. This is just the general idea. 
    		    //Object ->AIBlast();
    		    //DrawDebugLine(GetWorld(), StartTrace, EndTrace, FColor(255, 0, 0), true);
    			//UE_LOG(LogTemp, Warning, TEXT("AActorHit"));
    			//I am calling a function within the character. 
    			Object->ObjectBlast();
    	}

//This is the function I am calling within the character.

  void AParticularObject::ObjectBlast()
    {
    	AACharacter* Character= Cast<AACharacter>(GetWorld());
                                              
    	if (Character->bHit)    //Checks to see if the bHit is equal to true.
    	{
    		UE_LOG(LogTemp, Warning, TEXT("ObjectHit"));
                     //Destroy(); is something I would like to call here without crashing the engine. 
                     //I don't know if I have to use a Box Component or Sphere Component in order to resolve the issue. 
    	}
    	
    }

The reason for your crashes is because you are using Cast wrong, I suggest you read up a bit on those.

For example,

Cast<AAParticularObject>(GetWorld())

will always return null. Then you try to call Object->ObjectBlast() with a null object which causes a crash.
The same would happen in the second class (if it even reached there) because you cannot cast a World to a Character.

Regarding your question, you don’t need to have any code in the target object. You can perform a trace from the character, grab the hit object from the trace result, and act upon it.

The only thing object needs is a component with primitive collision (can be a box collision component or a mesh), with Query collision enabled, and collision response set to Blocking with the trace channel you are using (ECC_Visibility).
Here is an example for your trace code :

const float LineTraceLength = 20000.0f;
const FVector StartTrace = FirstPersonCameraComponent->GetComponentLocation();
const FVector EndTrace = (FirstPersonCameraComponent->GetForwardVector() * WeaponRange);
FCollisionQueryParams QueryParams(SCENE_QUERY_STAT(WeaponTrace), false, this);
// The trace result will be stored in this object
FHitResult Hit;
// This returns true for any blocking hit, but doesn't mean it was your object
if (GetWorld()->LineTraceSingleByChannel(Hit, StartTrace, EndTrace, ECC_Visibility, QueryParams))
{
    // Check if hit object is your object type
    AAParticularObject* Object = Cast<AAParticularObject>(Hit.GetActor());
    if (Object)
    {
        UE_LOG(LogTemp, Warning, TEXT("ObjectHit"));
        Object->Destroy();
    }
}

Now whether you execute the relevant code in character itself, or call a function to do it (Object->ObjectBlast()), doesn’t make any difference.
If you do call a function on the object, that function does not need to look for Character / check for hit, because you already checked before calling it.

If you want to use overlaps instead of blocking collision, you can use LineTraceMultiByChannel. That function works very similar to single line trace, but returns an array of FHitResult’s instead of a single one. Its documentation reads :

Trace a ray against the world using a specific channel and return overlapping hits and then first blocking hit

Results are sorted, so a blocking hit (if found) will be the last element of the array

Only the single closest blocking result will be generated, no tests will be done after that

Example for overlaps :

TArray<FHitResult> Hits;

// Here we don't care about return value because we don't look for blocking hit
GetWorld()->LineTraceMultiByChannel(Hits, StartTrace, EndTrace, ECC_Visibility, QueryParams);

// iterate all hits (overlaps)
for (const FHitResult& Hit : Hits)
{
    // check if this was our object type
    AAParticularObject* Object = Cast<AAParticularObject>(Hit.GetActor());
    if (Object)
    {
        UE_LOG(LogTemp, Warning, TEXT("ObjectHit"));
        Object->Destroy();
        // stop iterating
        break;
    }
}

Thank you very much! I now understand a bit more on Raycasting in C++! I have a question on the overlap. Would I have to create a function with the event begin overlap parameters in order to be able to detect the box collision using the raycast?

What is break used for?