Versy

  • Pridružuje se 4. stu. 2024
  • Davide

    Thank you so much for the update and the advice!

    I downloaded the new runtime and copied my code over to SpineSkeletonAnimationComponent.cpp again, but now the animation speed itself slows down, not the "framerate". Even without the if (Step <= 0.0f) return; it's doing this.😟 A bit hard to tell from the GIF but it's just playing all frames in slow-motion now, not skipping frames.

    Did something change significantly in this update that changes the way the animations play so that the code I have won't work anymore?

    If it's perhaps an oversight on my end please let me know!

    • Misaki Thank you, and that's totally fine. I have my strange "workaround" for now, and plenty of other things to work on. Cheers!

      • Misaki Yes that's correct! Apologies I meant to mention the level. This is indeed the issue I'm experiencing. Please let me know if you figure out the cause!

        • Misaki Sure thing I'll do that now! I put the code in your Spine example project file and it produces the same issue. Thank you for looking into it!

          • Misaki Alright, slightly embarrassing, but I've isolated the problem to a modification to SpineSkeletonAnimationComponent.cpp that I had someone do for me in order to get a specific framerate on my animations. I thought to check this before but completely forgot.


            I'm not the coder, but I believe what this is doing is only updating the skeleton on a lower interval instead of deltaTime, to mimic a low framerate. But that is likely causing updates to be "caught" in the middle.

            I know this is probably out of your support range because it's a modified feature, and I assume a faux "framerate" option like this isn't planned to be added to the runtime, so if you have any idea if there's a way to get this to play nice with the skeleton update please let me know! 🙏

            • Misaki

              SetAnimation shouldn't be getting called every tick, no. I currently have SetAnimation only being used On State Begin in my state machine, and then bools controlling whether it can transition to the next state, which are also only in On State Begin.

              I don't think it's setting the same animation every frame (I did make that mistake in the beginning) since that results in the animation being stuck on frame 1. With this problem, as you can see from my video below, it will start to play Walk when the character moves, but then if Walk is let go, it plays Idle "on top" of the frame that Walk stopped on.

              Setting all animation mixtimes to 0 stops the problem. But, of course, that's not a solution.

              Again, you can see eventually after a few animation transitions the problem stops. Which is why my "hack" is to just do that a few times at BeginPlay, and then all animations work fine. It's not a "real" solution though, I just am not sure what's going on.

              • This is an odd one.

                I have Idle play automatically on BeginPlay, but then any animation that I transition to (either Walk or Run in my case) gets "stuck" when it's supposed to go back to Idle. The character basically freezes mid-walk and then does the Idle animation but with the legs mid-stride, if that makes sense.

                Once you "break out" of this though by going back and forth between a couple more animations it goes back to normal and can't be reproduced during the rest of the play session.

                The only thing that's ""fixed"" it is by swapping animations at the start of BeginPlay with some Delays before going into my state machine to do the actual animation transition logic. I don't know why that works but it does.

                Does anyone have an idea for a non-hacky way to actually fix this? I don't think it's the actual transition logic because I've tried it three different ways and they all do this, so I must be missing something. It seems to have something to do with the mixtimes between animations, but ONLY ONCE after the game starts and never again. Any help appreciated!

                  • Uređeno

                  Misaki

                  Ahh! I'll do some reading on this then and see if it's worth the hassle or if I should just try adjusting my rig to not use wind physics. Thanks again!

                  The only downside to this is that the physics doesn't continue through the "flip" (the ears would flop when the character turns which looks really good), so flipping the skeleton is the ideal solution but then allowing flip of individual bones (to fix the hoodies strings going the wrong way for example).

                  I poked through all available functions and found Get Bone World Transform, which made me think I could use scale on that to flip a single bone (the ones with Wind physics). Unfortunately, there's no matching "Set Bone World Transform". I assume this is for a good reason, but wondering if there's functionality to flip individual bones in here somewhere that I'm missing.

                    Misaki

                    Thanks for the tip! Flipping the actor worked, though, I discovered this causes problems when the actor has a capsule collision component on it (because it's flipping that too)! Instead, I flipped the Spine Skeleton Renderer and that did the trick! I think I assumed it would show the back of the skeleton's draw order (which is an issue I was having earlier) so I didn't try it 😅.

                      Misaki

                      Thank you for your response and the suggestion! I tried out ResetPhysicsConstraints() with a debug key but all it did was return the physics bones to their original position for that frame then blew the wrong way again. Which made me realize... I think this is a problem with my rig setup.


                      I have wind and gravity physics in Spine making them point to the left on my run animation, and I guess this doesn't get mirrored when the skeleton is flipped in engine. I'm guessing wind and gravity are no-go's if you're re-using animations? Let me know if you have any suggestions outside of manually animating these parts of the rig.

                      Thanks again!

                        I set up my character to flip direction based on the documentation (with Set Scale X) but my character's physics bones still point the opposite direction.

                        Any idea how to fix this? UE 5.4.4 and Spine 4.2 if it matters!

                        • Nate
                          Sorry to bump this old thread, but is there an Unreal version of this code somewhere?