Forum rules - please read before posting.

Player stuck on moving on a single direction when using Move with Rigidbody

I am using AnimEngine_Spline if it helps.

When I move the player it only moves forward even when I press any WASD key

Comments

  • The animation engine shouldn't be a factor - but do you have Apply Root Motion unchecked in their Animator?

    I'll need more details - what are your AC/Unity versions, and can you share screenshots of your character's full Inspector and Settings Manager?

  • I don't have an animator, I did manage to fix it tho, I used facing directions -> None and not sure how else really I just tweaked and tweaked 🤷‍♂️

    Also, I am not sure how to set a Jump animation using the AnimEngine_Spine flow. There is no Bool to set like in a Mecanim Anim Engine.

    I did try a workaround which is making my own anim player but I'd like to know and use the correct AC Way for that.

  • You'd need to attach a custom script that listens out for the OnPlayerJump custom event, and plays a jumping animation. Something along these lines may do it:

    using UnityEngine;
    using AC;
    using Spine;
    using Spine.Unity;
    
    public class SpineJump : MonoBehaviour
    {
    
        public string jumpClip = "Jump";
        private bool isJumping;
    
        void OnEnable () { EventManager.OnPlayerJump += OnPlayerJump; }
        void OnDisable () { EventManager.OnPlayerJump -= OnPlayerJump; }
    
        void OnPlayerJump (Player player)
        {
            player.charState = CharState.Custom;
            SkeletonAnimation skeletonAnimation = player.GetComponent<SkeletonAnimation> ();
            if (skeletonAnimation)
            {
                skeletonAnimation.state.SetAnimation (0, jumpClip, false);
            }
        }
    
        void Update ()
        {
            if (isJumping && !KickStarter.player.IsJumping && KickStarter.player.IsGrounded ())
            {
                KickStarter.player.charState = CharState.Idle;
            }
        }
    
    }
    
Sign In or Register to comment.

Howdy, Stranger!

It looks like you're new here. If you want to get involved, click one of these buttons!

Welcome to the official forum for Adventure Creator.