I’ve been making some AI enemies using blackboards, and I get them to turn smoothly when the ‘Move To’ task is called by checking ‘Use Controller desired rotation’ in the enemy’s Character Movement component.
This led me to believe that the built-in ‘Move To’ task was getting the enemy to rotate by setting its control rotation. Therefore, when I wanted to make my own, custom ‘Aim At’ task I set the enemy’s control rotation, rather than the rotation of the actual actor. However, not only do my enemies not rotate when I do it this way, but debugging lines show that the control rotation doesn’t actually seem to have been changed at all.
This is also true when I create a basic test Character and try to increase the yaw of its controller on each Tick: when I then print the control rotation there is no change.
Does anyone know what’s going on here? Does the control rotation reset itself to the actor’s rotation for some reason? Does the Character Movement component do something mysterious behind the scenes that resets the control rotation? Or am I just using control rotation completely wrong?
Thank you!
btw I know I can just interpolate the rotation on the actor to get it smooth but I don’t want to
There’s a flag to orient the rotation based on the movement; maybe that’s turned on? (I forget the exact name)
Controller rotation usually means the camera. What direction the character’s camera is facing may not always be the same direction the mesh is facing.
Also, as the above poster mentioned, there are some settings in the character that can make you unable to directly alter your controller rotation. I think it is the one called “use controller rotation yaw” but I might be wrong.
Thanks! So, if (control) rotation is set to follow movement, does that mean I’m not allowed to set the control rotation directly?
You can set it directly:
It’s a rotator that other entities (generally pawns) can utilise:
Here’s a crude example:
- I am forcing control rotation to be this:
But I am also telling the pawn they do not need to use it. This allows me to rotate the pawn despite of what the Player Controller’s Control Rotation suggests.
- the behaviour if we do inherit:
Even if I wanted to rotate the Pawn, I no longer can - it’s now using Control Rotation.
What actually rotates the Pawn in the first example is this:
This is what @jwatte was referring to. And there is also a setting on the spring arm that allows it to mimick what the pawn is already doing.