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"

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:

alt text

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.

Product Version: UE 4.13
Tags:
lookatrot.png (64.3 kB)
more ▼

asked Oct 27 '16 at 06:16 AM in Blueprint Scripting

avatar image

HInoue
246 94 65 83

avatar image Speckulous Oct 27 '16 at 07:39 AM

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?

avatar image HInoue Oct 27 '16 at 12:43 PM

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.

avatar image HInoue Oct 27 '16 at 01:17 PM

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

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

0 answers: sort voted first
Be the first one to answer this question
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