So I'm trying to set up a multi line trace that will apply a force to destructible meshes when it passes through them. I think radial damage might be better than add impulse, but so far I haven't had any luck with radial damage; and impulse seemed to work fine for projectiles. Problem is some times the meshes just kinda give up? I'm not really sure how to describe it. Here's a video of the behavior. I have noticed that the DMs will not react if the damage done is extremely high or at least much higher than their health, but all 3 of these destructible meshes have the exact same properties (well, minus position obviously). Am I doing something wrong in my code, have I somehow goofed my DM settings, or is this a problem with the editor?
Below is my current setup (cut out the sound and animation bits since they're superfluous).
UWorld* const World = GetWorld();
if (World != NULL)
const FRotator SpawnRotation = GetControlRotation();
// MuzzleOffset is in camera space, so transform it to world space before offsetting from the character location to find the final muzzle position
FVector SpawnLocation = ((FP_MuzzleLocation != nullptr) ? FP_MuzzleLocation->GetComponentLocation() : GetActorLocation()) + SpawnRotation.RotateVector(GunOffset);
//Probably don't need to add static to the list but whatever.
FCollisionQueryParams TraceParams = FCollisionQueryParams(FName(TEXT("TraceParams")), false, this);
//endLocation will be where the trace stops
APlayerController *PC = Cast<APlayerController>(GetController());
//Getting point of reference for end of trace.
FVector EndLocation = PC->PlayerCameraManager->GetActorForwardVector();
FVector impulseFV = EndLocation * 10000.0f;
FString stringTest = impulseFV.ToCompactString();
//Multiplying starting reference to extend line and adding to camera location for proper alignment.
EndLocation = (EndLocation * 5000.0f) + (PC->PlayerCameraManager->GetCameraLocation());
DrawDebugLine(World, SpawnLocation, EndLocation, FColor(255,100,100), false, 2.5f, 0, 5.0f);
World->LineTraceMultiByObjectType(HitResults, SpawnLocation, EndLocation, ObjectList, TraceParams);
for (int i = 0; i < HitResults.Num(); i++)
hitSample = HitResults[i];
hitComp = hitSample.GetComponent();
Mar 16 '19 at 11:43 AM
in Using UE4