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"

What is ETraceTypeQuery

Does anyone know what the ETraceTypeQuery is? Its a type that is passed into functions such as GetHitResultAtScreenPosition and GetHitResultUnderCursorByChannel, but I'm not sure what it is. I'm using the previously mentioned functions to make a character look at the mouse in a top-down shooter. The problem is when the mouse moves over an obstacle it interferes with the direction the character faces. I was hoping the ETraceTypeQuery could solve this issue, just not sure how to use it.

Here is the code that I have:

 void ALaserTagPlayerController::RotateToMouseCursor() 
 {
     FHitResult Hit;
     //The two lines below have the same effect
     //GetHitResultUnderCursorByChannel(TraceTypeQuery1, false, Hit);
     GetHitResultAtScreenPosition(Cast<ULocalPlayer>(Player)->ViewportClient->GetMousePosition(), TraceTypeQuery1, true, Hit);
     const FVector PlayerPos = GetWorld()->GetFirstPlayerController()->GetCharacter()->GetActorLocation();
     FRotator PlayerRot = FRotationMatrix::MakeFromX(Hit.Location - PlayerPos).Rotator();
     PlayerRot.Pitch = 0.0f;
     this->GetCharacter()->SetActorRotation(PlayerRot);
 }


Thanks

Product Version: Not Selected
Tags:
more ▼

asked Jul 19 '14 at 08:24 PM in C++ Programming

avatar image

Snipe3000
74 20 21 24

avatar image 天天爱学习 May 04 '19 at 02:03 PM

Hello, in the 4.22.1 version, you can view the source code of the

UKismetSystemLibrary::LineTraceSingle()

function. In the first line,

ECollisionChannel CollisionChannel = UEngineTypes::ConvertToCollisionChannel(TraceChannel); ConvertToCollisionChannel()

This function converts the enumeration value. To the corresponding

ECollisionChannel

, for example ETraceTypeQuery I use the second TraceTypeQuery2, then the corresponding ECollisionChannel is

ECC_WorldDynamic UMETA(DisplayName="WorldDynamic")

, which is the second one.

(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