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 blackcode101 · Oct 11, 2020 at 01:12 PM · unity 2dshootinganimationspositions

health bar and shooting position are static and does not move with animation

Hi, i am making a small 2d game, i am still learning and new to unity. Currently i am facing this problem with shoot position and health bar position. when the player starts animating the health bar on the top of the player stays static and does not move during the animation, when the animation stops it does move when i simply move the player with idle animation. Same problem with shoot position, it always shoot from the same same position while in the animation the player position changes constantly. both objects are the child of the player.


the code i am using for shooting is:

  private IEnumerator StartShooting()
     {
         yield return new WaitForSecondsRealtime(0.5f);
         _shootCounter = 0;
         while (_shootCounter < 3)
         {
             _firstCall = false;
             _shootingCalled = true;
 
             **_anim.SetBool("startshooting", true);**
 
             **StartCoroutine(BurstFire());**
             _isShootingOn = true;
 
             yield return new WaitForSeconds(_anim.GetCurrentAnimatorStateInfo(0).length);
 
             //_anim.SetBool("startshooting", false);
 
             _isShootingOn = false;
 
             //_shootCounter += 1;
             //_shootingFinished = false;
             //yield return new WaitForSeconds(1f);
         }
         _shootingFinished = true;
         _stopTheDrop = false;
         StartCoroutine(MoveLeft());
     }
 
 
     ***public IEnumerator BurstFire()***
     {
         AudioSource.PlayClipAtPoint(_machinegunSound, Camera.main.transform.position);
 
         for (int i = 0; i < 20; i++)
         {
             if (Time.timeScale < 0.9f)
             {
                 yield return new WaitForSecondsRealtime(0.440f);
             }
             else
             {
                 yield return new WaitForSecondsRealtime(0.1f);
             }
 
           
             ***Instantiate(_heaveFire, _shootingPosition.position,_shootingPosition.rotation);***
         }
     }
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

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

Related Questions

How to Make Character Shoot Where Aiming with Mouse 0 Answers

I need help with an animation in unity 1 Answer

Make an obect take priority over another when touched? 0 Answers

Having problem with killing aliens in Space Invaders. 2 Answers

velocity of bullet in rifile rotation 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