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 knuckles209cp · Jan 12, 2014 at 12:07 AM · animationjavascriptgunshoot

Animation plays at original position?

I have a aim downs sights script and a gun fire animation , it works fine but the only problem is when i aim down sights and shoot the gun goes back to where i originally animated in , what i mean is that the gun goes back to its "Hip" position - to the side of the screen where it should be when NOT aiming down sights. i am absolutely clueless on what to do and i've done a LOT of research and I've look at forums , youtube and more stuff like that but nothing is helping . What should i do? *If you need a specific code i can give it to show you

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 ozku · Jan 17, 2014 at 06:34 AM 0
Share

Code should help because it should stop animation at last frame but do you have code something like this?

var ai$$anonymous$$g = false;

 function Update() {
 if(Input.Get$$anonymous$$eyDown("Fire2") && ai$$anonymous$$g == false){
 ai$$anonymous$$g = true;
 animation.Play("aim");
 }
 if(Input.Get$$anonymous$$eyDown("Fire2") && ai$$anonymous$$g == true) {
 ai$$anonymous$$g = false;
 animation.Play("hip");
 }
 }

if that won't work, send me the code and I'll have a look.

1 Reply

· Add your reply
  • Sort: 
avatar image
0

Answer by jorjdboss · Jan 17, 2014 at 06:58 AM

Create a parent object at the same position as gun and attach the gun as child. Add the aim down sight animation to the parent and remove it from the gun. You may want to have a separate fire animation for iron sights because the recoil is less compared to hip fire. You can play the aim animation forward or reverse. Depending on your aim state you would want to switch between the fire animations. Hope this helps

Comment
Add comment · Show 2 · 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 knuckles209cp · Jan 17, 2014 at 07:00 AM 0
Share

i dont have 2 animations i have one animation , and that was from the hip ... let me try that if that doesnt work ill make an animation in a separate program

avatar image jorjdboss · Jan 17, 2014 at 07:14 AM 0
Share

If you aren't shaking the gun too much like for example in BF3, then you should be fine with one animation. If you want the gun to You might want to move through the keyframes manually depending on the amount of time fire button is held and swiftly back to frame 0 when released.

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

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

Related Questions

Making an animation start when my gun fires 2 Answers

Can someone help me with my script? 0 Answers

Climb animation is glitchy and isnt working properly 0 Answers

Shooting & Animation Problem 1 Answer

machine gun js timing 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