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
0
Question by RuskiPOP · Feb 16, 2014 at 11:09 AM · movementfbxanimation clip

Playing move animation from fbx file

Hi. I'm newbie in Unity, and have a little problem. I've got a three .fbx file jump.fbx (jump animation) turn.fbx (turn left and right animation) mixed.fbx (some more animation like run, walk etc.) and i've got this script for move (without animation).

 #pragma strict
 
 var walkSpeed : float = 7;
 var gravity : float = 50;
 var rotationSpeed : float = 10;
 var yRot : float;
 
 function Update () {
     var Controller : CharacterController = GetComponent(CharacterController);
     var vertical : Vector3 = transform.TransformDirection(Vector3.forward);
     var horizontal : Vector3 = transform.TransformDirection(Vector3.right);
     
     if(Input.GetAxis("Vertical") || Input.GetAxis("Horizontal")){
         Controller.Move((vertical * (walkSpeed * Input.GetAxis("Vertical"))) * Time.deltaTime);
         Controller.Move((horizontal * (walkSpeed * Input.GetAxis("Horizontal"))) * Time.deltaTime);
     }
     if(Input.GetAxis("Mouse X")){
         yRot += 10 * Input.GetAxis("Mouse X");
     }
     transform.rotation = Quaternion.Euler(0, yRot, 0);
 }

It working, but my charcter doing only default animation from animator controller. So i get this script to get animation movement for my character:

 #pragma strict
 
 var walkSpeed : float = 7;
 var gravity : float = 50;
 var rotationSpeed : float = 10;
 var yRot : float;
 
 function Update () {
     var Controller : CharacterController = GetComponent(CharacterController);
     var vertical : Vector3 = transform.TransformDirection(Vector3.forward);
     var horizontal : Vector3 = transform.TransformDirection(Vector3.right);
     
     if(Input.GetAxis("Vertical") || Input.GetAxis("Horizontal")){
         animation.CrossFade("walk_normal0", 0.2);
         Controller.Move((vertical * (walkSpeed * Input.GetAxis("Vertical"))) * Time.deltaTime);
         Controller.Move((horizontal * (walkSpeed * Input.GetAxis("Horizontal"))) * Time.deltaTime);
     }else{
         animation.CrossFade("ArmatureAction0", 0.2);            
     }
     if(Input.GetAxis("Mouse X")){
         yRot += 10 * Input.GetAxis("Mouse X");
     }
     transform.rotation = Quaternion.Euler(0, yRot, 0);
 }

But now i get that error in Unity console:

MissingComponentException: There is no 'Animation' attached to the "jump" game object, but a script is trying to access it.

And i cant move my charcter in game, but default animation works.

PS. I use Unity 4.3 All of .fbx file have charcter model English is my second language, so please be lenient :)

Comment
Add comment · Show 2
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 getyour411 · Feb 16, 2014 at 11:11 AM 0
Share

Add Component / $$anonymous$$isc / Animation to the GameObject

avatar image RuskiPOP · Feb 16, 2014 at 01:17 PM 0
Share

Thanks for fast reply! I add Animation component, but now i get this errors:

The animation state ArmatureAction0 could not be played because it couldn't be found! The animation state walk_normal0 could not be played because it couldn't be found!

And that look my GameObject components (i can add only one Animation component, when i've got several animation): components

component.png (44.3 kB)

1 Reply

· Add your reply
  • Sort: 
avatar image
0
Best Answer

Answer by Pigold11 · Feb 16, 2014 at 01:39 PM

The AnimatoR (!) component works with a totally different animation system called "Mecanim", you don't seem to use it (what I do recommend, so watch this www.youtube.com/watch?v=Xx21y9eJq1U‎ ) but if you want to do it your way you need to add more animations to the AnimatioN (!) component, you do that by opening the Animations arrow and increase the size, so that you can add more animations. alt text


question.png (70.0 kB)
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

20 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 avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image

Related Questions

Raycast using Transform.Up issue - FBX Model from Messiah 1 Answer

Making a bubble level (not a game but work tool) 1 Answer

Where did my animation clips go? 0 Answers

How to create animation from FBX at runtime, not in editor! 1 Answer

Problems importing FBX model from 3DS and applying movement 1 Answer


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