Is there an easy way to flip animations for a 3D platformer? (i.e., character facing screen left and screen right)
I know the simplest answer is to rotate the capsule using the default bRotateToMovement, but that causes other issues later on down the line for like, the character always turns their back to the camera, or matching rotations to animations, or wall hanging, or anything that needs an immediate response from one direction to another. To me, it makes more sense to treat it like a 2D game with a static hitbox and keep the capsule rotation stationary and simply flip the character. Of course, you can’t do that because it’s auto-forced back to 0 once animation is finished.
The solution I’ve been using is to do every animation facing Right and then facing Left with a transition from right to left or left to right for a more natural turn. The issue here is, I’m doing double the work for every character. Even with a motion capture system, it’s tedious.
the concept you are describing is “Animation Mirroring” where we take the data from the animation and invert it across an axis (everything the right side does the left does instead, and vise versa)
you can look here
To make the turning snappier, you could use control rotation instead of orient to movement, then set control rotation on left/right input events.
As for the player turning their back to camera, after you figure out which way the controller naturally rotates by default, you can lock the camera to a rotation the player will always turn towards when doing a hard 180.
That’s how I do it in my 2.5d test project anyway. Personally, I’m not a fan of mirroring the anims (even though IGA did it that way for Bloodstained). It just seems weird to me when weapons magically jump from one hand to another. YMMV.
Yeah, Bloodstained is my reference piece for this project.
I’ve tried all sorts of manual rotations from control rotations to set actor rotations to add actor rotations, and lerping, it’s all buggy. When setting rots to 0 and 180 on input, that does work for instantaneous things but it’s far from natural.
I considered root motion, but when I started the project in UE4, root motion didn’t work with in air and from my experience was hard to cancel out of. The newer system in UE5 may be better?
Do you have a demo of your method? I’d like to see how it looks visually. Maybe it’s different than what I’ve tried?
The smoothest I’ve found is animating a turn from right to left and vice versa then I manually 180 the root bone on everything else and save/export as separate anims. After tinkering this afternoon, I don’t think the mirror feature will work for what I want, but I think I can use it for changing stances like a fighting game.
My concern though is how this feature impacts memory. I was sad to discover that it’s a runtime change.
for the weapon swapping hands, or say applying it only to the legs, and head you can utilize animation layers
or just only call the mirrored animation when it is applicable for handedness.
while the impact of mirror the animations themselves using Anim Data Tables: if you consider that an animation is just a set of rotations, and translations of the vertexes of the mesh (which animators, and engines will generalize by binding those vertexes to “Bones”). the Anim mirroring simply reads the data that already exists for the animation and applies it to the vertexes across the center axis of the Skeletal Rig, so no additional animation is created, just reading the values where the sign of a vector component is flipped.
if a separate animation was to be created it would need to reside in memory, and be referenced only when that mirrored portion was needed.
the animation mirroring has its largest application for fighting games, but also has application whenever say Handedness of a character is a question.
where the Animation Mirroring through Animation Data Tables falls down is when the “bones” of a Skeletal Mesh in question are not symmetrical about the up Axis relative to the forward, which can create strange behavior.
Unreal suggests the orientation of your FBX for import to be X+ Forward, and Z+ Up. with Scaling set to 1. regardless of your modelling software, most FBX exporters have the ability to re-orient the mesh with respect to the programs coordinate system.
it is optional to have the origin of the Skeletal Mesh to be at the center bottom of the model (between the feet) but this would be mostly for Animation re-targeting and consistency with the Unreal Maniquin and market place.
the orientation can be accounted for in the import settings.
Turning is kinda wonky as I only have a state with turn in place anims that plays when the yaw delta between the previous and current frame is > abs 0.
As for the bp, input and rotation settings for the movement comp look like this:
May also help to mention that “north” in editor is screen right and “south” is left; with the camera pointed west so player always turns towards it.
Added bonus of using controller desired rotation instead of orient to movement is the backwards dodge doesn’t spin the player around.