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"

How to set the rotation of an actor according to a vector direction?

Hello. I believe I have strong linear algebra and math foundation. But one concept puzzles me in this Unreal concept. I want to be able to create an indoor camera which follows the player character in a room. Usually I would approach this problem as follows; first, I would calculate the camera's location vector with respect to the origin and the player's location vector with respect to the origin. After that, I would subtract the camera's vector from the player's vector and convert it to unit vector. I would use that unit vector's direction as my "rotation" for my camera.

But in Unreal engine, there are two seperate things: Rotator and the location vector. What is the common ground between them for me to achive my goal? I mean how can I convert that result vector, which I subtracted two vectors, to "rotator" and use it on the camera?

Product Version: UE 4.9
Tags:
more ▼

asked Oct 17 '15 at 10:47 AM in Blueprint Scripting

avatar image

Bora Semiz
27 5 6 10

(comments are locked)
10|2000 characters needed characters left

2 answers: sort voted first

hi man , you are searching , Find look at rotation , and Rinterp !

The first will give you the rotator, to watch toward a direction vector, and the second will interpolate your camera rotation , so you will not have an istantperfect following camera.

The direction vector , is calculated as you said, subtracting the location Vector of the Watcher from the Watched.

alt text

lerp rotation.png (150.7 kB)
more ▼

answered Oct 17 '15 at 03:17 PM

avatar image

Est_engine
1.2k 58 12 62

(comments are locked)
10|2000 characters needed characters left

If you want more control, take a look at MakeRotFromX. You calculate a directional vector by subtracting target and source location and this function converts it to rotator.

more ▼

answered Feb 21 '18 at 08:15 PM

avatar image

Chairos
46 3 5

(comments are locked)
10|2000 characters needed characters left
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