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 tugaf94 · Oct 23, 2011 at 04:36 AM · animationweapon

weapon animation question

How can I associate animations to weapons? I made animations like switching weapon and bobbing weapon, but I can not associate the weapon switching animation to the key 2, or the bobbing animation to the ASD keys. Could someone tell me how could I do that ?

como posso criar associar animações em armas por exemplo eu fiz varias animaçoes a arma a trocar e a arma a mexer mas não sei associar a animação de trocar de arma a tecla 2 e a arma a mexer ás teclas a s d, someone could tell me how i do that?

Comment
Add comment · Show 7
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 tugaf94 · Oct 23, 2011 at 03:01 AM 0
Share

How can I create animations associated weapons, for example I made many animations to change the weapon and the weapon to move but I can not associate the animation to change the key weapon and the weapon 2 ASD keys to move, Could someone tell me how i do that ?

avatar image aldonaletto · Oct 23, 2011 at 03:38 AM 1
Share

@tugaf94, editei sua questão para ficar com o texto em inglês em primeiro lugar - isso facilita que as pessoas achem e respondam sua questão.

avatar image LegionIsTaken · Oct 23, 2011 at 08:29 AM 0
Share

Would you let others into that conversation? :)

avatar image syclamoth · Oct 23, 2011 at 08:40 AM 0
Share

Aldonaletto is telling tugaf94 that he edited the question to include an english translation, so that those of us who don't speak Portuguese can understand it and help with the problem! (I don't understand Portuguese, but Romantic languages are all basically the same so I could guess what I didn't know)

avatar image syclamoth · Oct 23, 2011 at 08:44 AM 0
Share

As for the actual question, that requires a few different things in order to work the way @tugaf94 wants it to. For starters, you need to have a weapon-switching system already implemented- do you have one of those? The bobbing animation isn't too hard, just put it in with your movement script (blend it in by (currentSpeed/maxSpeed)). Have you imported all the animations properly? $$anonymous$$ake sure your bob animation is set to 'Loop', so that it won't just finish on you.

Show more comments

1 Reply

· Add your reply
  • Sort: 
avatar image
0

Answer by benjimazza · Oct 23, 2011 at 09:33 PM

So all you want is a Weapon Switching script ??? if so then this should do

function Start()

{ SwitchWeapon(0); }

function Update () { if(Input.GetKeyDown("1"))

 {
     SwitchWeapon (0);
 }

 else if(Input.GetKeyDown("2"))

 {
     SwitchWeapon (1);
 }
 else if(Input.GetKeyDown("3"))
 
 {
     SwitchWeapon (2);
 }

}

function SwitchWeapon(index : int)

 {
         for( var i = 0; i<transform.childCount; i ++)
 {
     if(i == index)
 {
         transform.GetChild(i).gameObject.SetActiveRecursively(true);
 }
         else transform.GetChild(i).gameObject.SetActiveRecursively(false);
 }

}

Comment
Add comment · Show 1 · 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 tugaf94 · Oct 24, 2011 at 12:26 PM 0
Share

yes but with animation when i swicth weapon start an animation

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

6 People are following this question.

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

Related Questions

How do you check what function your animation is calling? 0 Answers

Attach weapon to both hands? 2 Answers

Can I make animations snap to a frame? 1 Answer

Character Equip Animation 0 Answers

Is there a Mecanim callback for, "Where X bone would be if IK was off"? 0 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