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 george3d2011 · Aug 22, 2013 at 06:21 PM · animationrotationposition

Run Animation Rotation - Position

Hey Guys, Recently I started making an FPS Multiplayer Game. When I reached the animation creation I realized that when I tried to make the Run Animation I changed the rotation of the weapon -45 degrees (everythings fine so far). When the run animation was being interupted by the walk animation (for example when you Get the button up) my weapon does not change its rotation to the default of the walk animation (0 degrees) it just stays the same -45 degrees.. how can i fix that?

Comment
Add comment · Show 5
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 Seizure · Aug 22, 2013 at 06:44 PM 0
Share

Post your code so we can see where you went wrong.

avatar image Hyperion · Aug 23, 2013 at 12:51 AM 0
Share

Did you have a keyframe for the weapon inside the walk animation?

avatar image meat5000 ♦ · Aug 23, 2013 at 01:29 AM 0
Share

Is the weapon a child of the hand? It should follow its transform.

avatar image george3d2011 · Aug 23, 2013 at 01:20 PM 0
Share

I have keyframes which changes the position - rotation of the animation holder where my weapon and the hands are inside, however animation holder is a child of the main camera

avatar image thebestprogrammer · Aug 18, 2014 at 03:09 PM 0
Share

I've the same problem... I need help..

1 Reply

· Add your reply
  • Sort: 
avatar image
0

Answer by george3d2011 · Aug 23, 2013 at 08:47 AM

 public Transform AnimationHolder;
 
 public CharacterController CharCont; 
 
 public CharacterMotor CharMotor;
 
 public WalkingState walkingstate = WalkingState.Idle; 
 
 public float VelocityMagnitude; 
 
 public float WalkSpeed; 
 
 public float RunSpeed;
 
 public bool WasStanding;
 
 public void AnimationController()
 {
     if(WasStanding && !CharCont.isGrounded) 
 { 
     WasStanding = false; 
     WalkAnimationHolder.animation.Play("animationSTANDINGJUMP");
 }
 else if (!WasStanding && CharCont.isGrounded)
         {
                WasStanding = true;
                WalkAnimationHolder.animation.Play("animationSTANDINGJUMPLANDING");
         }

 
     //Run
     if(walkingstate == WalkingState.Running)
     {
            WalkAnimationHolder.animation["animationRUN"].speed = VelocityMagnitude / RunSpeed * 1.2f;
            WalkAnimationHolder.animation.CrossFade("animationRUN", 0.2f);
     }
 
     //Walk
     else if (walkingstate == WalkingState.Walking)
     {
            WalkAnimationHolder.animation["animationWALK"].speed = VelocityMagnitude / WalkSpeed * 1.2f;
            WalkAnimationHolder.animation.CrossFade("animationWALK", 0.2f);
     }
 
     //Reloading
     else if(walkingstate == WalkingState.ReloadState)
     {
            WalkAnimationHolder.animation.CrossFade("animationRELOADING", 0.2f);
     }
 
     //Staying Put
     else
     {
            WalkAnimationHolder.animation.CrossFade("animationIDLE", 0.2f);
     }

}

Here are my codes. I have to say that when the animation RUN is being interupted by the walk animation, the walk animation Plays FINE! the only which goes wrong is that my weapon stays at -45 degrees because my run animation requires -45 degrees (Y). And Yes the weapon is a child of the AnimationHolder and the hands too.

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

19 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

Related Questions

set child object position when playing the animation 0 Answers

Position of GameObject changes when animating 2 Answers

Simple animations - hardcoded or import animation 1 Answer

animation & position problem 0 Answers

Only animate rotation not position 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