I’m working on an action/RPG that uses root motion and a moving camera. The stick inputs should move the character relative to the camera, but require the correct startwalk animation to fire off, which has been tough to find a working solution for. The blendspace for startwalk ranges from -180 to 180, so to get the correct relative angle I tried finding the difference between the camera forward vector and mesh right vector. It seemed like adding this to the Atan2 of the Axis Inputs should have produced the correct result, going off of what the strings printed, but using the sum for the Desired Rotation variable (which the blendspace uses for its input angle), the character never moves all the way in the right direction, and sometimes goes the wrong way. Most of the time they move around two thirds of the way toward wherever the stick inputs are guiding them, but always in a fraction; if started and stopped again over and over, they’ll slowly close in on the angle. How can I fix this?
When using the a2tan return value directly for the Desired Rotation, the character always initiates walking in exactly the right direction (so I don’t think there are any issues on the anim blueprint side), but since that’s directly from the axis inputs it always makes forward on the stick forward for the character without factoring in the position of the camera.
Update: I’m still having this problem, but have noticed after fixing some issues with the 180 degree turn that while the character is going through the turning animation, the desired rotation angle breaks out of the -180 to 180 range. I’m not sure if this is related to the main problem or just an issue about the mesh rotation during the animation itself (it doesn’t affect anything after that animation is complete), but I don’t understand how that would be mathematically possible given the current layout. I’ve been stuck on this for three days. If anyone has a solution or a similar problem I would love to see another approach. I’ve been looking through dozens of tutorials and searching the forums, and found some similar problems but no solution that seems to work.
I’m adding pictures of how the inputs respond during play; blue is the value of the Desired Rotation output, green is the return value of the Atan2 (degrees) node, and red is the yaw from the break rotator node after the delta of the x vectors from the camera boom forward and mesh right vectors. So, for a before and after in the first two pictures, if I am looking 90 degrees away from the character (to their right), if I press forward on the stick for an input of zero, they should rotate 90, but don’t go all the way, unless I keep stopping and starting again with a 0 input, eventually cutting enough into the remaining difference. The third example pic is for an attempt to turn left 90 with the camera starting behind the character, and the error seems to work uniformly in all directions (except during 180 degree turns, where the numbers exceed the -180 to 180 range). Oh, and in every image, the direction the character is running is where I held the input and the direction they settled in; I have not enabled rotating them during walk/run, so that you can see exactly what direction they settled on. My theory was that the character’s rotation might be changing the input to the blendspace, but the input to the blendspace should be instant, shouldn’t it?




