Are you using quaternions for rotation? I have a vague memory that quaternions can encode up to 720° in each axis, (-2PI .. +2PI) I think? So you can have rotations that have identical orientation, but lerping between them does a complete spin. IIRC a fix is to convert all your quats to axis/angle and then back to quats.
±180 degrees, and yeah, I was thinking that anim interpolation here takes a long way around because of quaternion rotation interpolation, but I don’t know enough about anim trees and blending to identify the problem.
@Help Out of curiosity, can you try putting more keyframes for the sword animation? Maybe also turn off optimization and/or compression in the import settings.
I dunno, it doesn’t seem like there were any tears that suddenly spun the sword around. Pretty sure its not flipped on the other animations, too. I did try to 360 the sword in all directions on idle - didn’t work.
Should probably also mention I don’t use AnimationTrees, I find them a nuisance to work with. All blends are done through the customBlend parameter of AnimationPlayer.Play().
This seems a question to ask on Blender Stack Exchange. The issue is likely not Godot. It doesn’t do things you don’t tell it to. It is more likely that there’s something going on when you make the animation in Blender and Godot is either compensating for it, or you are embedding it in Blender without knowing it. Either way, we don’t have many Blender experts here, and over there they are super helpful and knowledgeable.
I would recommend you provide more information over there when posting.
What animation(s) are we looking at in the video? Is it one or multiple?
What animation method are you using?
If you’re using a skeletal bone system, does the sword have its own bone? (It shouldn’t and that could be your problem.)
Are your animation(s) looped? Are they returning to the same spot they started, or are you forcing the game engine to smooth that out? (Also could be your problem.)
Physics. When you swing a sword, it is not a part of your body. The movement of your hand, arm and torso are what move it. Taking that bone out of the sword will likely solve your problem.
I think it depends on the approach: if all the animations are baked then it doesn’t matter whether the weapon is a bone.
@Help One more problem that I know of is with the frames themselves - see if Godot imports the animation with the same total number, and that the zero and last frame correctly represent the frames in Blender respectively.
It’s not always sheathed, and it’s not always unsheathed. I might also need animations, for example, which spin the sword in the air, like a taunt. How else would I achieve that, other than animating the bone?
I actually parented the sword to the upper torso, so that I won’t have to redo the animations I made before adding the weapon. Checked if that is the problem just now - it wasn’t.
I export Blender animations with the 0-frame setting. It IS indeed imported wrong actually! Godot shows RunUnsheathe to last from frame 0 to frame 16, whereas Blender shows from frame 1 to 14! The hell…?
Edit: Tried to turn off the setting and, apart from regaining the old problem of character just standing there for a frame in the beginning of the animation, fixed nothing.
The answer to this question is, you would just imagine if you yourself did not have a sword bone in your body and what you would do to sheathe and unsheathe a sword. Animating a spinning in the hand is also pretty easy if you just add an animation line in Godot to animate the sword to spin on its y-axis.
In fact, you can animate the same spinning on the y-axis in Blender without a bone. I’ve made animations in Blender where I scaled, moved and rotated pieces of a model to look like it was exploding and dissolving. The object had no bones.
So you’re saying that if the sword is parented to the upper torso, it still spins about uncontrolled? That’s interesting data. It means that either it has nothing to do with your animations, or you are animating something you don’t realize you are animating.
Regardless, it sounds like the sword is intended to be a part of your character, so perhaps your approach is the right one. I’m used to making games where characters can swap out weapons. I’m not sure how your character will let go of the sword once sheathed, but if they’re going to run around with their hand on the pommel like a samurai it shouldn’t be an issue.
I kinda see what you mean, I may need to try other approaches when I will try sword model swapping. But animating in Godot is a smell. I’m trying to make a slasher here, so I do most likely need control over the sword.
I saw similar behaviour from Godot when creating some smaller animations, what i’ve found there was that it runs from -180 to 180 instead of 0-360, which was the values i was setting, and then i used the gizmo to move it a bit, in which it used -180 to 180, which then gave me 360 flips.
The way i got it fixed was to ensure that either the number was between 0-360, or -180 and 180.
Tho i ended up just keeping it between 0 and 360, and holding off minus values. Since that effectively was what was causing the issue for me.
Dont know if its similar or the same, just wanted to mention it.