Hello all!

I apologize if I don't understand, I'm not good with code if it comes to it ;w;! This is a silly question, I know.

tldr; I have a spine animation imported into Unity, there is an idle looping track, but the physics don't work unless I set the Time Scale = 1 in the SpineAnimation script (it's set as 0), but it makes the idle looping track faster. Curious how to keep the animation track idle at the same speed, but have the physics work with the idle animation track as the driving force.


I have physics set-up in my rig and my TimeScale is 0 in the SpineAnimation under Inspector. The physics don't show up at all but the idle animation does play as expected and this has worked in the past as I would manually animate all the physics, etc. (so not adding in the new physics feature).

Physics DO work once I set the Time Scale to 1! But, it also makes the idle animation I already have go faster, and that's not something I want to happen.

I did reference this post, and tried to set the timeScale = 1 in the code we have but it yielded results as expected (I saw it updated the same property in the SkeletonAnimation in Inspector on Unity and was confused since I thought they were separate according to the thread).

I've been scratching my head over this as I do want to utilize the physics (it's been a wonderful timesaver!) but how do I have the physics I set up react to the idle looping animation track I already made (in Spine) without making timeScale = 1 and therefore making my idle animation go faster.

I feel like I'm overlooking something so obvious 😭

Again, I apologize for not understanding this as much as I should. I tried my best to seek out the answer and I feel it's just something I need clarifying insight on. I appreciate any help! Thank you so much 😃

    Related Discussions
    ...

    To address your issue of having the physics work correctly without speeding up your idle animation, you can use the TrackEntry.timeScale property to control the speed of individual animations. This way, you can keep the overall AnimationState.timeScale at 1 (which is necessary for the physics to work correctly) while adjusting the speed of your idle animation separately.

    Here's a step-by-step approach:

    1. Set the AnimationState.timeScale to 1: This ensures that the physics calculations are performed correctly.

    2. Adjust the TrackEntry.timeScale for the idle animation: This allows you to control the speed of the idle animation independently of the overall time scale.

    Here is an example of how you can do this in code:

    // Assuming you have a reference to your SkeletonAnimation component
    SkeletonAnimation skeletonAnimation = GetComponent<SkeletonAnimation>();
    
    // Set the overall time scale to 1 for physics to work correctly
    skeletonAnimation.timeScale = 1;
    
    // Get the TrackEntry for the idle animation
    TrackEntry idleTrackEntry = skeletonAnimation.state.SetAnimation(0, "idle", true);
    
    // Adjust the time scale for the idle animation to slow it down
    idleTrackEntry.timeScale = 0.5f; // Adjust this value as needed

    In this example, the idle animation will play at half speed (0.5f), while the overall timeScale is set to 1 to ensure the physics work correctly.

    By using the TrackEntry.timeScale, you can fine-tune the speed of individual animations without affecting the physics calculations.

    For more details, you can refer to the TrackEntry.timeScale documentation.

    I hope this helps! Let me know if you have any further questions.

    animatorsan but the physics don't work unless I set the Time Scale = 1 in the SpineAnimation script (it's set as 0), but it makes the idle looping track faster.

    Time Scale is a multiplier, so 1 is the default. Setting it to 0 freezes time and does not play back an animation at all.

    If your animation is playing back "faster" with time scale 1, then something's wrong elsewhere with your setup.