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"

LineTraceComponent broken on 4.14

Hello

I have tried pretty much every single thing so far and nothing i have done has worked. So

To give some context, Im performing a trace that comes from two sockets on the player weapon. i get these locations each tick and then use these for the trace. using draw debug line i can see that they are being displayed and updated correctly

However when using LineTraceComponent the results arent constant, and the trace registers hit events even when it hasnt hit anything. Here is a video showing clearly the issue as well the code im using (Im using the K2 function since it draws the trace better, using the standard LineTraceComponent function still gives the same issue )

 if (Pawn->GetMesh()->K2_LineTraceComponent(TraceStart, TraceEnd, true, true, Hit, Norm,F))

https://www.youtube.com/watch?v=CGiNiWyKcdY&feature=youtu.be

Product Version: UE 4.14
Tags:
more ▼

asked Nov 29 '16 at 10:03 PM in Bug Reports

avatar image

alvarofer0020
90 15 17 23

avatar image Doug E ♦♦ STAFF Dec 01 '16 at 05:27 PM

Hey alvarofer0020-

If you're able to reproduce this behavior in a new project, can you provide the setup steps to help me test the issue? How and where are you using the line of code above? Please provide as much information as possible to help me reproduce this behavior locally.

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

2 answers: sort voted first

Hey Alvarofer0020-

Thank you for the sample project. I have reproduced this issue and logged a report for it here https://issues.unrealengine.com/issue/UE-40025 . You can track the report's status as the issue is reviewed by our development staff. Please be aware that this issue may not be prioritized or fixed soon.

Cheers

Doug Wilson

more ▼

answered Dec 22 '16 at 08:30 PM

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

Hey

Yes i have been able to reproduce the behavior in a new project . Also here is a link to a example project using only the starter content. hold your left mouse button and move arround. you will see that the trace "hits" the character even if the trace hasnt hit anything

https://mega.nz/#!o80CiQ4a!vazT4OiDk0jYZElTWUUeqKO0Wl5RrsqJ5GcQa1GQfXo

Here is the complete sample of the code im using (this is being done on Tick)

 void AMeleeWeapon::Tick(float DeltaSeconds)
 {
     Super::Tick(DeltaSeconds);
 
     FVector TraceStart;
     FVector TraceEnd;
     int i;
     FHitResult HitData(ForceInit);
     FCollisionQueryParams Params;
 
     /* if we should trace*/
     if (bTrace)
     {
     
         StartSockEnd = Mesh->GetSocketLocation(SocketStartName);
         EndSockEnd = Mesh->GetSocketLocation(SocketEndName);
 
         for (i = 0; i<TracesPerSwing; i++)
         {
             
             TraceStart = FMath::Lerp(StartSockEnd, EndSockEnd, i / TracesPerSwing); 
     
             TraceEnd = FMath::Lerp(LastFrameStartSockEnd, LastFrameEndSockEnd, i / TracesPerSwing); 
 
             if (bDrawTraces)
             {
                 DrawDebugLine(Instigator->GetWorld(), TraceStart, TraceEnd, FColor::Red, false, 5, 0, 2.0);
             }
             
 
             for (FConstPawnIterator Iterator = GetWorld()->GetPawnIterator(); Iterator; ++Iterator)
             {
                 ACharacter* Pawn = Cast<ACharacter>(*Iterator); 
                 if (Pawn && Pawn != WeaponOwner) //
                 {
                     if (WeaponOwner->GetDistanceTo(Pawn) <= MeleeRadius)
                     {
 
                        if (Pawn->GetMesh()->LineTraceComponent(HitData, TraceStart, TraceEnd, Params))
                        {
                            if (CheckHurtEnemies(Pawn) == true)
                            {
                                OnHit(HitData);
                            }
                        }
                     }
                 }
             }
         }
         LastFrameStartSockEnd = StartSockEnd;
         LastFrameEndSockEnd = EndSockEnd;
     }
 
 }

(LastFrameStartSockEnd, LastFrameEndSockEnd,StartSockEnd and EndSockEnd are vectors i declared in the actor header, Mesh is a skeletal mesh component attached to the player hand )

Basically. Once bTrace is true, i start by setting the StartSockEnd & EndSockEnd vectors to the location of a socket in the Mesh component. Then i perform a loop based on a float value ( TracesPerSwing ) Inside that loop i interpolate the current trace location & the previous frame trace location using lerp so the current trace gets done with both locations so it doesnt miss any spaces if the frame rate drops

Then i proceed to iterate trough all of the pawns in the world, and grab only the ones close to the weapon owner <= melee radius ( 800 units ) , Finally if the pawn we have got trough the iterator is not the owner i perform the LineTraceComponent against "that" character mesh. and At that point is where the trace goes crazy

However the vectors and locations are correct, since if you use DrawDebugLine on both TraceStart & TraceEnd they display correctly. only using them on LineTraceComponent causes the issue

more ▼

answered Dec 01 '16 at 06:50 PM

avatar image

alvarofer0020
90 15 17 23

avatar image Doug E ♦♦ STAFF Dec 02 '16 at 03:43 PM

It appears that the project you provided is using the MeleeTrace plugin, are you able to reproduce the issue without the use of the plugin? Additionally, the provided project does not have a Source folder and does not appear to use code, is the AMeleeWeapon::Tick() code part of the plugin?

avatar image alvarofer0020 Dec 02 '16 at 05:01 PM
avatar image alvarofer0020 Dec 13 '16 at 03:41 PM

any updates?

(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