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"

Modifying line trace params causes P.I.E. crash.

I'm trying to implement a line trace (-Z) from the player pawn, all is going well bar the line trace hitting the pawn itself. After doing a bit of searching I came across jayice's answer on this question, a solution which to me made sense. However, trying to run the compiled code in New Editor Window (P.I.E) resulted in this crash, with the resulting log.

This caused some confusion as I wasn't expecting such a negative result. Unable to quickly find an answer on the web I turned to coming up with an alternate solution. This was to offset the line trace's origin, this too resulted in an error(). I'd assume a different one as I disabled the FCollisionQueryParams::AddIgnoredActor() modification I'd made. Log.

I'm at a loss as to why this is happening and would appreciate some in figuring this out. The code in question is below, with the commented parts being the two different methods I used to modify the starting location.

 void ACube_Base::Tick(float DeltaTime) {
 // ...
 FVector StartLoc = Mesh->GetComponentLocation();
     //StartLoc.Z += -10.f;
     //StartLoc += FVector(0.f, 0.f, -10.f);
     FVector UpVector = Mesh->GetUpVector();
     FVector EndLoc = ((UpVector * -1000.f) + StartLoc);
     DrawDebugLine(GetWorld(), StartLoc, EndLoc, FColor::Red, false, 1, 0, 1);
     FHitResult Hit;
     FCollisionQueryParams CollisionParams;
     if (GetWorld()->LineTraceSingleByChannel(Hit, StartLoc, EndLoc, ECC_Visibility, CollisionParams)) {
         if (Hit.bBlockingHit) {
             GEngine->AddOnScreenDebugMessage(-1, 2.f, FColor::Yellow, CollisionParams.ToString());
             GEngine->AddOnScreenDebugMessage(-1, 2.f, FColor::Yellow, StartLoc.ToString());
             GEngine->AddOnScreenDebugMessage(-1, 2.f, FColor::Red, FString::Printf(TEXT("You are hitting: %s"), *Hit.GetActor()->GetName()));
             GEngine->AddOnScreenDebugMessage(-1, 2.f, FColor::Red, FString::Printf(TEXT("Impact point: %s"), *Hit.ImpactPoint.ToString()));
             GEngine->AddOnScreenDebugMessage(-1, 2.f, FColor::Red, FString::Printf(TEXT("Normal point: %s"), *Hit.ImpactNormal.ToString()));

If you want the full source for the class, just ask and I'll chuck it up on Google Drive.

Product Version: UE 4.21
error.txt (2.3 kB)
error2.txt (2.3 kB)
cube.log (60.3 kB)
cube2.log (59.4 kB)
more ▼

asked Mar 11 '19 at 06:44 AM in C++ Programming

avatar image

5 2 2 4

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

0 answers: sort voted first
Be the first one to answer this question
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