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"

How can I find angle between 2 vectors (Points in world coordinate)?


Is there any build in function that can allow me to find the Rotator between 2 points(vectors) in the world coordinate?

I tried searching a few maths libraries but couldn't find any. So is there a function that can do what I want or I need to manually write the function?

Product Version: Not Selected
more ▼

asked May 09 '14 at 05:33 AM in C++ Programming

avatar image

428 77 118 148

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

1 answer: sort voted first
 FVector Angle = (TargetPosition - MyPosition);
 FRotator Rotation = FRotationMatrix::MakeFromX(Angle).Rotator();

Basically, to find vector between two other vectors you have to subtract one from another.

http://blog.wolfire.com/2009/07/linear-algebra-for-game-developers-part-1/ something like this would help understanding math.

more ▼

answered May 09 '14 at 07:17 AM

avatar image

1.6k 54 38 105

avatar image envenger May 09 '14 at 07:29 AM

Ok thanks.. I don't have much idea about RotationMatrix. Will check it surely.

I was going to use something similar to this http://wiki.beyondunreal.com/Legacy:Useful_Maths_Functions#Rotations_between_two_Vectors

I guess both of them similar results.

avatar image BiggestSmile May 09 '14 at 03:08 PM


"Creates" matrix using X value of given vector, Rotator() returns resulting FRotator.

avatar image imskull Jun 03 '16 at 08:07 AM

No, it uses the given vector AS x-axis, it doesn't mean to use only x value of given vector.

(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