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?
asked Oct 17 '15 at 10:47 AM in Blueprint Scripting
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.
answered Oct 17 '15 at 03:17 PM
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.
answered Feb 21 '18 at 08:15 PM
Follow this question
Once you sign in you will be able to subscribe for any updates here