Wayback Machinekoobas.hobune.stream
May JUN Jul
Previous capture 13 Next capture
2021 2022 2023
1 capture
13 Jun 22 - 13 Jun 22
sparklines
Close Help
  • Products
  • Solutions
  • Made with Unity
  • Learning
  • Support & Services
  • Community
  • Asset Store
  • Get Unity

UNITY ACCOUNT

You need a Unity Account to shop in the Online and Asset Stores, participate in the Unity Community and manage your license portfolio. Login Create account
  • Blog
  • Forums
  • Answers
  • Evangelists
  • User Groups
  • Beta Program
  • Advisory Panel

Navigation

  • Home
  • Products
  • Solutions
  • Made with Unity
  • Learning
  • Support & Services
  • Community
    • Blog
    • Forums
    • Answers
    • Evangelists
    • User Groups
    • Beta Program
    • Advisory Panel

Unity account

You need a Unity Account to shop in the Online and Asset Stores, participate in the Unity Community and manage your license portfolio. Login Create account

Language

  • Chinese
  • Spanish
  • Japanese
  • Korean
  • Portuguese
  • Ask a question
  • Spaces
    • Default
    • Help Room
    • META
    • Moderators
    • Topics
    • Questions
    • Users
    • Badges
  • Home /
avatar image
3
Question by philipstraw · Apr 23, 2015 at 11:34 PM · animationprocedurallocomotion

LocomotionSystem not working in Unity 5

I'm fairly new to scripting and I'm trying to test the Locomotion System asset in Unity 5 so I can use procedural animations in my project, but when I hit play the legs don't animate and I get these error messages:

alt text

The lines in the LegController script creating these errors are as follow (respectively):

.........................

(LegAnimator.cs line 254)

controlMotionState.enabled = true;

.........................

(LegAnimator.cs line 390)

MotionGroupState group = motionGroupStates[g];

........................

(LegAnimator.cs line 1889)

switch (legState.phase) {

........................

I couldn't get the character to move using the NormalCharacterMotor script, so I wrote my own movement script which works fine:

using UnityEngine; using System.Collections;

[RequireComponent(typeof(CharacterController))] public class movement : MonoBehaviour {

 Vector3 direction = Vector3.zero;

 void Update () 
 {
     CharacterController controller = GetComponent<CharacterController>();
 direction = new Vector3(Input.GetAxis("hori_left_stick"),0,Input.GetAxis("vert_left_stick"));
 controller.Move(direction);
 }

}

...................

Other than the movement script, everything is set up according to the documentation. The Animation component is attached and contains the all the animations including the ones I'm targeting ("idle1" and "walkForward"). I've searched and searched but haven't found a relevant answer. Is this some sort of Unity 5 compatibility issue?

alt text

legcontrollersetup.jpg (213.6 kB)
locomotion-system-errors.jpg (183.5 kB)
Comment
Add comment · Show 1
10 |3000 characters needed characters left characters exceeded
▼
  • Viewable by all users
  • Viewable by moderators
  • Viewable by moderators and the original poster
  • Advanced visibility
Viewable by all users
avatar image domini · Jun 11, 2015 at 04:49 PM 0
Share

Oh yes it would be great if the locomotion system will be fixed for Unity 5. When I tried it last time even the default demo scene where the man is walking around was behaving very strange.

That currently keeps me from switching over to Unity 5. Alternatively I would need to learn how to move a legacy 4 leg animal with mecanim, I failed to get it working.

3 Replies

· Add your reply
  • Sort: 
avatar image
5

Answer by domini · Jun 21, 2015 at 11:15 AM

OK, as nobody else answered, I started to have a look myself ;)

... and here are my first results.

The problem is the animation system. Unity 5 REQUIRES to mark "LEGACY ANIMATION" as such.

So you need to change the two commands where the "DUMMY ANIMATION" is created and mark them explicitly as legacy like this:

Near Line 254:

             // Create dummy animation state with control motion name
             //GetComponent<Animation>().AddClip(new AnimationClip(), "LocomotionSystem");
 
             AnimationClip newAnim = new AnimationClip();
             newAnim.name = "LocomotionSystem";
             newAnim.legacy = true;
             GetComponent<Animation>().AddClip(newAnim, "LocomotionSystem");



Near Line 285:

                 // Create dummy animation state with motion group name
                 //GetComponent<Animation>().AddClip(new AnimationClip(), legC.motionGroups[g].name);
 
                 AnimationClip newLegCAnim = new AnimationClip();
                 newLegCAnim.name = legC.motionGroups[g].name;
                 newLegCAnim.legacy = true;
                 GetComponent<Animation>().AddClip(newLegCAnim, legC.motionGroups[g].name);


Comment
Add comment · Show 4 · Share
10 |3000 characters needed characters left characters exceeded
▼
  • Viewable by all users
  • Viewable by moderators
  • Viewable by moderators and the original poster
  • Advanced visibility
Viewable by all users
avatar image igfados · Aug 30, 2015 at 09:19 PM 0
Share

can i have your script file?

avatar image igfados · Sep 03, 2015 at 07:36 PM 0
Share

still doesn't fix the problem for me, any solution?

avatar image domini · Sep 05, 2015 at 08:35 PM 1
Share

Hi, sure, I added my script, there are some more modifications than mentioned here, mainly because I had some problems with editor play mode. For some reason I cannot upload it here directly so I had to upload it elsewhere:

LegAnimator

avatar image MihajloNen · Sep 24, 2019 at 08:30 AM 0
Share

Hi guys, I know this is a thread written 4 years ago but I can't find any proper solution for exactly your issues even in late 2019... Did you manage to get the Locomotion system running? The legacy animation seem no longer to be valid as it deletes those if you drag and drop them into the animation slots (for animation groups) when pressing Play. And in fact they don't even appear as selection options in the editor...

avatar image
1

Answer by kfirmon · Nov 25, 2015 at 03:15 PM

I'm working with Unity 5.2.2f1 and I had to do it this way: Line 251: // Create dummy animation state with control motion name //GetComponent().AddClip(new AnimationClip(), "LocomotionSystem");

             AnimationClip newAnim = new AnimationClip();
             newAnim.name = "LocomotionSystem";
             newAnim.legacy = true;
             GetComponent<Animation>().AddClip(newAnim, "LocomotionSystem");
             controlMotionState = GetComponent<Animation>()["LocomotionSystem"];


and then Line 287: // Create dummy animation state with motion group name //GetComponent().AddClip(new AnimationClip(), legC.motionGroups[g].name);

                 AnimationClip newLegCAnim = new AnimationClip();
                 newLegCAnim.name = legC.motionGroups[g].name;
                 newLegCAnim.legacy = true;
                 GetComponent<Animation>().AddClip(newLegCAnim, legC.motionGroups[g].name);
                 controller = GetComponent<Animation>()[legC.motionGroups[g].name];


hope this helps ;)

Comment
Add comment · Share
10 |3000 characters needed characters left characters exceeded
▼
  • Viewable by all users
  • Viewable by moderators
  • Viewable by moderators and the original poster
  • Advanced visibility
Viewable by all users
avatar image
0

Answer by muzboz · Nov 18, 2016 at 07:44 AM

Thanks for the tips guy... It also spat a few errors about Horizontal2, Vertical2 and Sneak not being set up in the Input Manager. I just duplicated Horizontal and Vertical, and renamed them with the "2" on the end. And I duplicated Fire and called it "Sneak", and it all worked!

Comment
Add comment · Share
10 |3000 characters needed characters left characters exceeded
▼
  • Viewable by all users
  • Viewable by moderators
  • Viewable by moderators and the original poster
  • Advanced visibility
Viewable by all users

Your answer

Hint: You can notify a user about this post by typing @username

Up to 2 attachments (including images) can be used with a maximum of 524.3 kB each and 1.0 MB total.

Follow this Question

Answers Answers and Comments

10 People are following this question.

avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image

Related Questions

Arms Locomotion 0 Answers

Create Player From Values [ Photon ] 0 Answers

Can I make animations snap to a frame? 1 Answer

How do I overlay (blend) my own procedural animation on top of a canned animation? 3 Answers

How to create physics based animation character like in (GANG BEASTS)? 2 Answers


Enterprise
Social Q&A

Social
Subscribe on YouTube social-youtube Follow on LinkedIn social-linkedin Follow on Twitter social-twitter Follow on Facebook social-facebook Follow on Instagram social-instagram

Footer

  • Purchase
    • Products
    • Subscription
    • Asset Store
    • Unity Gear
    • Resellers
  • Education
    • Students
    • Educators
    • Certification
    • Learn
    • Center of Excellence
  • Download
    • Unity
    • Beta Program
  • Unity Labs
    • Labs
    • Publications
  • Resources
    • Learn platform
    • Community
    • Documentation
    • Unity QA
    • FAQ
    • Services Status
    • Connect
  • About Unity
    • About Us
    • Blog
    • Events
    • Careers
    • Contact
    • Press
    • Partners
    • Affiliates
    • Security
Copyright © 2020 Unity Technologies
  • Legal
  • Privacy Policy
  • Cookies
  • Do Not Sell My Personal Information
  • Cookies Settings
"Unity", Unity logos, and other Unity trademarks are trademarks or registered trademarks of Unity Technologies or its affiliates in the U.S. and elsewhere (more info here). Other names or brands are trademarks of their respective owners.
  • Anonymous
  • Sign in
  • Create
  • Ask a question
  • Spaces
  • Default
  • Help Room
  • META
  • Moderators
  • Explore
  • Topics
  • Questions
  • Users
  • Badges