Download

Look at rotation stops working correctly when player turns around

Hi guys! I’ve got a problem here that I’ve asked several places for help and haven’t been able to find a solution. Here’s hoping!

My player character is a mech that auto-targets enemies and turns its head to look at them. So I’ve been trying to get the Look At Rotation from the player to the targeted enemy, sans the player’s current orientation, and use that to manipulate the player’s head bone, like this:

Anim blueprint:

http://i.imgur.com/L3yg4U6.jpg

Get Head Rotation function (the FrontFacer socket and the -90 degrees are because the skeletal mesh is rotated 90 degrees):

http://i.imgur.com/BRvRAdE.jpg

Applying the rotation:

http://i.imgur.com/QAJv34U.jpg

It ALMOST works. For enemies that are “north” of the player (for lack of a better term), it seems to work great. But if I turn around to target enemies to the “south,” the head’s up/down axis seems to get inverted. If I’m looking at enemies directly to the east and west, the head ***** over from side to side. Here’s a video of what I’m talking about:

https://youtube.com/watch?v=wXUnWS9o6Ew

Any thoughts? Am I doing something obviously wrong here? Thanks in advance!

Some other info, in case it makes a difference:

This is how I used to have my function set up, and it behaved exactly the same as in the video. Someone also told me to try doing it like this, but, again, the problem persists.

Another person told me to plug the Look At Rotation directly into the output in my function, but that returned wildly unusable results–I think the look at rotation seems to be in world space while the head look in my anim graph is being applied in local space (if I’m using that terminology correctly).

Pretty much at the end of my rope here. :frowning:

I got a chance to mess with this a bit more, and a coworker suggested this alternate setup–I don’t really understand how it works but I figured it was worth a try:

NsP8UUf.jpg

It didn’t fix the problem, which still persists (although now the character’s head seems to twitch around in ways that it didn’t before, so it’s slightly worse). Video of the new setup

[video]https://youtu.be/t_O7oF7MUjY[/video]

Does that give anyone any ideas?

It’s fixed, thanks to some help from Reddit! In case anyone runs across this thread with the same problem, I had to set it up like this:

rotation_fixed.jpg

Apparently modifying rots like that is a bad idea :slight_smile: