Using Mixamo Animations for the blend tree animation

I have been working on this course and have gotten to where I am working on the cinimachine section. But I want to try and build this using Mixamo character animations for the player and enemy. So i can have further modify and add additional animations and interactions in the sandbox.


Here are two images, one is what my settings are for the animation. I set it up exactly the same as the tutorial setup as. But the animations numbers are different than for the animations from the tutorial. The other attachment is the error message that I am receiving when I test movement.

The errors all seems to be centered around the following code snip shown below.

private bool InteractWithMovement()
        {
            RaycastHit hit;
            bool hasHit = Physics.Raycast(GetMouseRay(), out hit);
            if (hasHit)
            {
                if (Input.GetMouseButton(0))
                {
                    GetComponent<Mover>().StartMoveAction(hit.point, 1f);
                }
                return true;
            }
            return false;
        }

I know from looking through this that I am almost completely positive the issue is with the 1f variable since the animations that have put in no longer match the speeds I had before with the other animations. But I can not figure out what to change exactly to get this to work.

Actually, the error is in Mover.cs in the StartMoveAction() method on line 34.
Paste in that script and we’ll have a look.

Here is my Mover.cs script.

using System;
using System.Collections;
using System.Collections.Generic;
using RPG.Core;
using UnityEngine;
using UnityEngine.AI;

namespace RPG.Movement
{
    public class Mover : MonoBehaviour, IAction
    {
        [SerializeField] Transform target;
        [SerializeField] float maxSpeed = 6f;

        NavMeshAgent navMeshAgent;
        Health health;

        // Start is called before the first frame update
        void Start()
        {
            navMeshAgent = GetComponent<NavMeshAgent>();
            health = GetComponent<Health>();
        }

        // Update is called once per frame
        void Update()
        {
            navMeshAgent.enabled = !health.IsDead();
            UpdateAnimator();
        }

        public void StartMoveAction(Vector3 destination, float speedFraction)
        {
            GetComponent<ActionScheduler>().StartAction(this);
            MoveTo(destination, speedFraction);
        }

        public void MoveTo(Vector3 destination, float speedFraction)
        {
            navMeshAgent.destination = destination;
            navMeshAgent.speed = maxSpeed * Mathf.Clamp01(speedFraction);
            navMeshAgent.isStopped = false;
        }

        public void Cancel()
        {
            navMeshAgent.isStopped = true;
        }

        private void UpdateAnimator()
        {
            Vector3 velocity = navMeshAgent.velocity;
            Vector3 localVelocity = transform.InverseTransformDirection(velocity);
            float speed = localVelocity.z;
            GetComponent<Animator>().SetFloat("forwardSpeed", speed);
        }
    }
}

if the error is in mover StartMoveAction line 34 is:
GetComponent<ActionScheduler>().StartAction(this);

So I am guessing the issue is I need to set that line as a variable equal to this? Then call that somewhere? Or the issue is when I call “this” at the end in StartAction(this).

But I am not sure how to solve it if I am on the right track here with the error.

It looks like you don’t have an ActionScheduler attached to the character.

Privacy & Terms