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 Trevor The Hyena · Feb 16, 2013 at 01:20 AM · componentmechanimparameter

Using Mechanim for FP Animation - Help

I'm finally making progress on my First Person game, but now I need to know how to use Mechanim for FP animations. I have an "Idle" animation set up as the default animation on my Right Hand in Mechanim, I also have 2 Swing animations for my Right Hand which have a condition set up using an Int, if the Int is 0, the default animation is playing, if the Int becomes 1, the first swing animation is played, if the Int becomes 2, the second animation is played, both set to return to the Idle animation with Exit Time. The Int variable is called "Attack" in the script I want to use, but I don't know how to access the Parameters in Mechanim using this script. Could someone please help me ASAP? Here's the script I'm using to change the Int value based on an input on my controller:

 function Update()
 
     {
 
     if(Input.GetAxis("Fire1") && attack == 0)
 
         {
 
         attack = 1;
 
         attacktime = 2.0;
 
         }
 
     if(Input.GetAxis("Fire1") && attack == 1)
 
         {
 
         attack = 2;
 
         }
 
     if(attacktime > 0.0)
 
         {
 
         attacktime -= 1.0 * Time.deltaTime;
 
         }
 
     if(attacktime < 0.0)
 
         {
 
         attacktime = 0.0;
 
         }
 
     if(attacktime == 0.0)
 
         {
 
         attack = 0;
 
         }
 
     }

Judging by the Mechanim tutorial with the Robot on YouTube, you need a few lines of Code that access this parameter in Mechanim. I'd love it if someone could re-write my code so that it accesses this "Attack" (Int) Parameter.

Thanks in Advance,

Trevor

Comment
Add comment
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

0 Replies

· Add your reply
  • Sort: 

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

9 People are following this question.

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

Related Questions

Multiple Cars not working 1 Answer

problem with FindWithTag 2 Answers

AI movment script funtion start error ? 1 Answer

Digital Clock: Time.time > 60 2 Answers

Need Help Fixing WeaponScript *(cant find compiler error) 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