I’m currently developing an RTS project with Unreal, and so far I have done some good progress considering is my first ever game. However, I have a doubt regarding the character animations.
I have setup a 2D blendspace for my locomotion, but inside my game (using ‘click/move to’ system) it looks like it only recognizes my blendspace as a 1D and it look very choppy as shown in this video:
As you can see in the video above, my characters change direction really abruptly, just snapping onto the new course.
I’m also attaching below my code from the CharacterAnimBP showing my calculations for Speed and Direction.
My goal is to have the character blend animations when changing directions after clicking a new location on the map, blending direction changes, etc. What would be the best way to achieve this?
I’m not entirely sure, but I have a couple possibilities here:
Have you tried to adjust the interpolation rate for the x axis to something above 0?
In your character movement component, what are your rotation settings?
On the character movement component details panel under rotation settings there is a check box, off by default, to use Controller desired rotation.
There is also orient rotation to movement, which overrides this setting as well as an option to adjust the rotation rate.
Maybe try adjusting some of those settings? I’d say either check the “Use Controller Desired Rotation” or crank up the z value. There could be something about how you’re instructing the pawn to move that makes these settings invalid. Post your results below if you need more help and I’d be glad to continue troubleshooting.
If this has been helpful, please mark my answer as accepted.
The above functionality allows me to run on a double click event. I was trying to include a section to calculate rotation to this part as well, as I have done within my AnimBP (visible in my first post above) but it requires me to add a TARGET which is the AnimInstance, and I’m not sure how to get it from inside the Character controller or the characterBP. Not even sure if this would actually help but here is a screenshot of the resulting error:
Hey, glad to help! Sorry it’s still not working. This is getting a bit tricky. What’s the controller look like? input yaw scale might have something to do with it.
Also on the character there’s “use controller rotation yaw” which is on by default on character class. maybe turn that off? possible the controller snaps to a rotation using simple move to. Also, the tooltip for “Orient Rotation to Movement” on movement component states that it overrides “use controller desired rotation” and recommends clearing “use controller rotation yaw”… just a thought.
One user at the end of This thread states they had to disable orient rotation to movement. So its possible there is some combination of these check boxes that works…
maybe disable all three?
as for getting a reference to the anim instance, you can get a reference to the mesh and from there get the anim instance.
Thanks again for your help on this, the above solution has resolve the snapping issue! Now I just need to figure out a way to make the character use the entire 2D blendspace set of motions!
But I will open a new thread for that. Thanks again for your help!