x

Search in
Sort by:

Question Status:

Search help

  • Simple searches use one or more words. Separate the words with spaces (cat dog) to search cat,dog or both. Separate the words with plus signs (cat +dog) to search for items that may contain cat but must contain dog.
  • You can further refine your search on the search results page, where you can search by keywords, author, topic. These can be combined with each other. Examples
    • cat dog --matches anything with cat,dog or both
    • cat +dog --searches for cat +dog where dog is a mandatory term
    • cat -dog -- searches for cat excluding any result containing dog
    • [cats] —will restrict your search to results with topic named "cats"
    • [cats] [dogs] —will restrict your search to results with both topics, "cats", and "dogs"

Destructible Meshes stop responding?

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).

 void Adestructiblefps1Character::OnFire()
 {
         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);
                 
                 TArray<FHitResult> HitResults;
                 FCollisionObjectQueryParams ObjectList;
                 //Probably don't need to add static to the list but whatever.
                 ObjectList.AddObjectTypesToQuery(ECC_WorldStatic);
                 ObjectList.AddObjectTypesToQuery(ECC_PhysicsBody);
                 ObjectList.AddObjectTypesToQuery(ECC_Destructible);
                 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);
                 FHitResult hitSample(ForceInit);
                 UPrimitiveComponent* hitComp;
                 for (int i = 0; i < HitResults.Num(); i++)
                 {
                     hitSample = HitResults[i];
                     hitComp = hitSample.GetComponent();
                     hitComp->AddImpulseAtLocation(impulseFV, hitSample.Location);
                 }
         }
 }

Product Version: UE 4.20
Tags:
more ▼

asked Mar 16 '19 at 11:43 AM in Using UE4

avatar image

amwilliams
1 2

(comments are locked)
10|2000 characters needed characters left
Viewable by all users

1 answer: sort voted first

So placing DMs next to each other on startup then having chunks touch another DM seems to cause the problem. Workaround is just not place them next to each other, and they can fall into or collide with each other fine.

more ▼

answered Mar 19 '19 at 08:08 PM

avatar image

amwilliams
1 2

(comments are locked)
10|2000 characters needed characters left
Viewable by all users
Your answer
toggle preview:

Up to 5 attachments (including images) can be used with a maximum of 5.2 MB each and 5.2 MB total.

Follow this question

Once you sign in you will be able to subscribe for any updates here

Answers to this question