GeckoLib

GeckoLib

146M Downloads

transitionLengthTicks is constant, despite setting it in the AnimationController constructor or by modifying event.getController().transitionLengthTicks

doctor4t opened this issue ยท 5 comments

commented

Environment: Fabric
GeckoLib Version: 3.0.1

Despite setting the value of transitionLengthTicks to 0 (which should cancel the transition between animations) or any other value in the constructor or during the predicate method by modifying event.getController().transitionLengthTicks, the transition time between animations doesn't change at all. I've measured this time to be approximately of 2 seconds, if the animation is near its end but not fully. A few details about the animation:

  • The animation was made on BlockBench with the Geckolib plugin and exported / saved to the mod's animation resources folder
  • The animation properly plays in-game
  • The animation is set to loop. In my case, the animation is a running animation triggered in the predicate function when the entity is moving.
  • The animation is the only animation on the entity.
  • The animation starts directly from a moving pose (and not the base pose).
  • The animation switches from no animation (when the entity is still) to the running animation (when the entity is moving). The transition between no animation to the running animation seems to be instantaneous, which corresponds to the value of transitionLengthTicks.
  • However, the problem appears when transitioning from the running animation to no animation (when the entity stops moving). In my case, there is an approximative transition of 2 seconds, when there shouldn't be any because of the value of transitionLengthTicks being set to 0 in the AnimationController constructor.

I've noticed the transition seems to be as long as the transition between animations for the modified Creeper. I've encountered this problem two times now, despite strictly following the wiki.

In my case in particular, I am making a Rat entity, with only one animation currently as I mentioned earlier: a running animation.
Inside RatEntity.java, this is my predicate() function:

private <E extends IAnimatable> PlayState predicate(AnimationEvent<E> event) {
    if (event.isMoving()) {
        event.getController().setAnimation(new AnimationBuilder().addAnimation("animation.rat.run", true));
        return PlayState.CONTINUE;
    }
    return PlayState.STOP;
}

How I register my animation controllers in the same class:

@Override
public void registerControllers(AnimationData data) {
    data.addAnimationController(new AnimationController<>(this, "controller", 0, this::predicate));
}

And finally, my RatEntityModel.java class code:

public class RatEntityModel extends AnimatedGeoModel<RatEntity> {
    @Override
    public Identifier getModelLocation(RatEntity object) {
        return new Identifier(Rats.MODID, "geo/entity/rat.geo.json");
    }

    @Override
    public Identifier getTextureLocation(RatEntity object) {
        return new Identifier(Rats.MODID, "textures/entity/"+object.getRatType().toString().toLowerCase()+".png");
    }

    @Override
    public Identifier getAnimationFileLocation(RatEntity object) {
        return new Identifier(Rats.MODID, "animations/entity/rat.animation.json");
    }
}

If more code is needed, the rest of it is present here.

I will add a video of the animation inside the game once I have a stable enough internet connection

commented

And here is the video of it happening in-game
https://streamable.com/l952eb

commented

I've noticed that transitioning to the animation actually respects the set amount of transition ticks (in my case 0), but transitioning from always stays constant no matter the transition length.

Here is another video showcasing the issue with another animation: https://streamable.com/49pu3b

commented

@AzureDoom Updated to 3.0.14 and the issue is still there sadly.

commented

Hey @doctor4t can you retest this on the latest?

commented

Confirmed fixed in latest issue. Closing