Download

Need some help with rotating the head of my skeletal mesh in animation blueprint.

Hey, i have been working on getting so that my AI can look around at various locations in the world but cannot figure out what i’m doing wrong.
I have a AwnserHub post that i explain it in, Need help with rotating a skeletal mesh bone so that it is facing a certain direction. - UE4 AnswerHub, But i will explain it here also.

So i have the animation blueprint set up like this.

The rotation that i want to set the bone rotation to i get by doing this, where the socket is located at the eyes of the skeletal mesh. MostInterestingPoint is a vector of the location of the point that i want it to look at.



if (!MostInterestingPoint.IsZero())
 {
     FVector TempVec = MostInterestingPoint - ControlledPawn->GetMesh()->GetSocketLocation("headSocket");
     LookAtRotation = FRotationMatrix::MakeFromX(TempVec).Rotator();
 }


Doing this, should i not just be able to put in the rotation into the Transform Bone node and have it work? Or am i doing something wrong? Currently when doing it like this his head is rolled to the side and it gets very weird rotations.
Let me know if i need to further explain something.