- Home /
Mixamo Animation Problem
Hello,
I recently purchased a Mixamo animations pack but after importing it an error occurred reading:
Assets/EveryDayPack-Womens/RootMotionCharacterControlFEMALE.cs(10,16): error CS0246: The type or namespace name `RootMotionComputer' could not be found. Are you missing a using directive or an assembly reference?
When I go into the RootMotionCharacterControl script this is what appears:
using UnityEngine; using System.Collections;
[AddComponentMenu("Mixamo/Demo/Root Motion Character")] public class RootMotionCharacterControlFEMALE: MonoBehaviour { public float turningSpeed = 90f; public RootMotionComputer computer; public CharacterController character;
void Start()
{
// validate component references
if (computer == null) computer = GetComponent(typeof(RootMotionComputer)) as RootMotionComputer;
if (character == null) character = GetComponent(typeof(CharacterController)) as CharacterController;
// tell the computer to just output values but not apply motion
computer.applyMotion = false;
// tell the computer that this script will manage its execution
computer.isManagedExternally = true;
// since we are using a character controller, we only want the z translation output
computer.computationMode = RootMotionComputationMode.ZTranslation;
// initialize the computer
computer.Initialize();
// set up properties for the animations
animation["talking01"].layer = 0; animation["talking01"].wrapMode = WrapMode.Loop;
animation["sexywalk"].layer = 1; animation["sexywalk"].wrapMode = WrapMode.Loop;
animation["goofyrun"].layer = 1; animation["goofyrun"].wrapMode = WrapMode.Loop;
animation["femtoughwalk"].layer = 3; animation["femtoughwalk"].wrapMode = WrapMode.Loop;
animation["no"].layer = 3; animation["no"].wrapMode = WrapMode.Once;
animation["sassywalk"].layer = 3; animation["sassywalk"].wrapMode = WrapMode.Loop;
animation["standinggreeting"].layer = 3; animation["standinggreeting"].wrapMode = WrapMode.Once;
animation["talking02"].layer = 3; animation["talking02"].wrapMode = WrapMode.Once;
animation["tellsecret"].layer = 3; animation["tellsecret"].wrapMode = WrapMode.Once;
animation.Play("talking01");
}
void Update()
{
float targetMovementWeight = 0f;
float throttle = 0f;
// turning keys
if (Input.GetKey(KeyCode.A)) transform.Rotate(Vector3.down, turningSpeed*Time.deltaTime);
if (Input.GetKey(KeyCode.D)) transform.Rotate(Vector3.up, turningSpeed*Time.deltaTime);
// forward movement keys
// ensure that the locomotion animations always blend from idle to moving at the beginning of their cycles
if (Input.GetKeyDown(KeyCode.W) &&
(animation["sexywalk"].weight == 0f || animation["run"].weight == 0f))
{
animation["sexywalk"].normalizedTime = 0f;
animation["goofyrun"].normalizedTime = 0f;
}
if (Input.GetKey(KeyCode.W))
{
targetMovementWeight = 1f;
}
if (Input.GetKey(KeyCode.LeftShift) || Input.GetKey(KeyCode.RightShift)) throttle = 1f;
// blend in the movement
animation.Blend("goofyrun", targetMovementWeight*throttle, 0.5f);
animation.Blend("sexywalk", targetMovementWeight*(1f-throttle), 0.5f);
// synchronize timing of the footsteps
animation.SyncLayer(1);
// all the other animations, such as punch, kick, attach, reaction, etc. go here
if (Input.GetKeyDown(KeyCode.Alpha1)) animation.CrossFade("femtoughwalk", 0.2f);
if (Input.GetKeyDown(KeyCode.Alpha2)) animation.CrossFade("no", 0.2f);
if (Input.GetKeyDown(KeyCode.Alpha3)) animation.CrossFade("sassywalk", 0.2f);
if (Input.GetKeyDown(KeyCode.Alpha4)) animation.CrossFade("standinggreeting", 0.2f);
if (Input.GetKeyDown(KeyCode.Alpha5)) animation.CrossFade("talking02", 0.2f);
if (Input.GetKeyDown(KeyCode.Alpha6)) animation.CrossFade("tellsecret", 0.2f);
}
void LateUpdate()
{
computer.ComputeRootMotion();
// move the character using the computer's output
character.SimpleMove(transform.TransformDirection(computer.deltaPosition)/Time.deltaTime);
}
}
Can anyone give me any advice on what i'm suppose to change?! I can't apply animations to the character model because in the Animator component it says under controller 'None (Runtime Animator Controller)....I'm at a loss here :/
Answer by jazzcake · May 18, 2014 at 05:22 PM
As I understand, RootMotionComputer is for legacy animation system not for Mechanim.
If you use Mechanim, you don't need to use RootMotionComputer. Mechanim already has good alternative root motion system.
Your answer
Follow this Question
Related Questions
Character moving up when animated. 1 Answer
Modify animation performed by a character rigged in mixamo 0 Answers
Can I make animations snap to a frame? 1 Answer
Root Motion with Animations in Unity 2018 0 Answers
Charcter change clothes 0 Answers