Having trouble deriving neck rotation from lookat rotation

I’m trying to write an event in my AI controller which rotates the model’s head to look at an actor. My first attempt was to just use FindLookAtRotation, and set the resulting rotator as the desired rotation of the head bone:

This produces weird results, and usually ends up with the character looking in a completely unrelated direction. My assumption is that either FindLookAtRotation isn’t returning the result I think it is (although the API says it’s just the rotation necessary to face the target vector; that seems right), or there’s some kind of weird world-local space confusion that I’m not catching. (I know the head bone, at least, rotates locally: FRotator(0,0,0) will always make the head look straight ahead).

So is there an obvious problem with how I’m using rotators? My use case is so simple that I must be doing something really fundamental wrong.

Did you check if the values are correct?

Print them and check if they are correct (Place your Character where you know his poisition.)

Also move your character after the first print while playing and check if the values change accordingly to your exceptions. How do the values change?

A character standing 15 degrees anticlockwise of the person moving their head should return an angle of 345 (or -15), and returns an angle of -131. Putting them directly in front of each other (so it should return 0) returns -115.

Ack, I fixed it- I needed to adjust the result from lookatrotation by the rotation of the actor who was looking- everything works now :slight_smile: