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"

GetHitResultUnderCursorForObjects and EObjectTypeQuery in C++

There are a few questions discussing EObjectTypeQuery on the AnswerHub that were never answered but they are fairly old so I am hoping something has changed in the meantime. I am trying to use GetHitResultUnderCursorForObjects() so something like this

 TArray< TEnumAsByte< EObjectTypeQuery > > objects;
  FHitResult hitResult;
 if ( GetHitResultUnderCursorForObjects(objects,true,hitResult))
 // Do the stuff...

but how do I know which object ObjectTypeQuery1 corresponds to? Just for concreteness lets say I am trying to find HitResults for objects derived from a class called AShape. Is there any workaround for this? In blueprints you can see the list of objects so I assume it must be possible somehow.... Thanks!

Product Version: UE 4.19
more ▼

asked Apr 02 '18 at 12:43 PM in C++ Programming

avatar image

10 1 4

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

1 answer: sort voted first

The logic of the pointed method is based on "collision channels" and not directly on "actor types". Here you can find more detailed information using BP (of course it applies also to C++): https://impetus-games.com/blog/Rotating-an-Actor-towards-the-Mouse-Cursor-in-UE4 .

For the C++ side, after having properly configured the collision channels as explained in the above link, here is an example on how to fill the input array using both predefined and custom collision channels:

 TArray<TEnumAsByte<EObjectTypeQuery> > objTypes;
 // From "common" ECollisionChannel values
 // From "custom" collision channels.
 ECollisionChannel CollisionChannel;
 FCollisionResponseParams ResponseParams;
 if (UCollisionProfile::GetChannelAndResponseParams(FName(TEXT("MyChannel")), CollisionChannel, ResponseParams))
more ▼

answered Jan 02 '19 at 07:40 PM

avatar image

217 16 22 29

(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