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"


Hello everyone and Happy New year !

I'm encountering a problem at the moment. Assume you have a grid, projected in 2D space within the 3D world with some length. (for example a grid of 32 clusters) I'm trying to sort out thoses clusters to find, for a specific cluster, which are the nearest clusters in 4 directions (left-right-up-down). I obtained by using a line trace the cluster which is "selected", and the grid array corresponding to all clusters in the grid. So to sort out positions of those clusters, I'm assuming I can do it by checking their position from a point (I'm using the world origin), and checking how they are elevate and left or right from that origin. That's here that I try to use the function FMath::GetAzimuthAndElevation().

But I'm having a lot of troubles to use it. I don't understand how to use it correctly. What it needs to works fine as what I'm trying isn't giving any good results. Does anyone knows how to use it correctly?

I hope I'm explaining well what is my problem as I'm not native in english :p...

Have a nice day guys !

Product Version: UE 4.19
more ▼

asked Jan 06 '19 at 03:12 PM in C++ Programming

avatar image

11 1 2 3

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

1 answer: sort voted first


To use FMath::GetAzimuthAndElevation method, you first need to define vectors that are the base axis used to calculate it. In my example I wanted to take the Elevation and Azimuth of an actor from the origin of the world (coordinates 0,0,0), this following code works well ;) :

 const FVector AxisX = FVector::ForwardVector;
 const FVector AxisY = FVector::RightVector;
 const FVector AxisZ = FVector::UpVector;
 FVector DirectionToOrigin = Cluster->GetActorLocation() - FVector(0, 0, 0);
 FVector2D AzimuthAndElevationFromOrigin = FMath::GetAzimuthAndElevation(DirectionToOrigin, AxisX, AxisY, AxisZ);

more ▼

answered Jan 07 '19 at 04:55 PM

avatar image

11 1 2 3

(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