suriyun-mmorpg / UnityMultiplayerARPG_2DAI

AI implement for 2D mode, which implements A* Pathfinding Project
MIT License
10 stars 0 forks source link

Sprite delay when turning direction #1

Closed NowsfekyBR closed 4 years ago

NowsfekyBR commented 5 years ago

I am using the addon, it works very well but I see that there is a sprite delay when turning direction. Can you improve this so that the sprite always turns at the same time you change direction?

insthync commented 5 years ago

You can try to fix it by changes codes in CharacterModel2D → Play() function from line 145 to

        public void Play(AnimationClip2D anim)
        {
            if (anim == playingAnim)
                return;

            playingAnim = anim;
            spriteRenderer.flipX = anim.flipX;
            spriteRenderer.flipY = anim.flipY;
            secsPerFrame = 1f / anim.framesPerSec;
            currentFrame = -1;
            playing = true;
            nextFrameTime = Time.realtimeSinceStartup + 0.025f;   // Add some delay to avoid glitch
        }
nowsfeky commented 5 years ago

Perfect. That worked. But why is only AILerp working? When I try to use AIPath, the movement doesn't change at all. What can it be ?

insthync commented 4 years ago

The demo using AIPath and it's working, you should try see component settings in Seeker, AIPath components