envenger
(envenger)
May 9, 2014, 5:33am
1
Hi…
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?
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.
Linear algebra for game developers ~ part 1 - Wolfire Games Blog something like this would help understanding math.
envenger
(envenger)
May 9, 2014, 7:29am
3
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.
FRotationMatrix::MakeFromX(Angle)
“Creates” matrix using X value of given vector, Rotator() returns resulting FRotator.
imskull
(imskull)
June 3, 2016, 8:07am
5
No, it uses the given vector AS x-axis, it doesn’t mean to use only x value of given vector.