Wayback Machinekoobas.hobune.stream
May JUN Jul
Previous capture 14 Next capture
2021 2022 2023
2 captures
12 Jun 22 - 14 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 /
  • Help Room /
avatar image
0
Question by WeirderChimp · Jan 24, 2016 at 04:07 PM · animatormecanimstate-machinebehaviour

Animator MatchTarget Problem On OverRide Animation Layer (Has GIF)

Hey.

So im making a character Controller and adding animations where the character jumps over a barricade. In mecanim i have a Locomotion Layer(handles movement) then an Override Layer(handles the jumping over barricade), my actual set up is much more complicated then this, but this simple set up reproduces the problem.

alt text alt text

Im Having problems with the Jump Animations. This state has a Behaviour (IMPORTANT) so when the Jump State is playing we match target.

here is the code for the Behaviour:

 public class TestBehaviour : StateMachineBehaviour {
 
      // OnStateEnter is called when a transition starts and the state machine starts to evaluate this state
     override public void OnStateEnter(Animator animator, AnimatorStateInfo stateInfo, int layerIndex) {
         animator.transform.position = GameObject.Find("StartPos").transform.position;
         animator.transform.rotation = GameObject.Find("StartPos").transform.rotation;
             //-------- StatePos(YELLOW SPHERE) gameobject is so when the animation states we are in the correct position
     }
 
     // OnStateUpdate is called on each Update frame between OnStateEnter and OnStateExit callbacks
     override public void OnStateUpdate(Animator animator, AnimatorStateInfo stateInfo, int layerIndex) {
         animator.MatchTarget(GameObject.Find("HandPos").transform.position, GameObject.Find("HandPos").transform.rotation, AvatarTarget.RightHand, new MatchTargetWeightMask(Vector3.one, 0f), 0.15f, 0.6f);
      //-------- HandPos(RED SPHERE) is the gameobject's position for where we want our Righthand to matchTarget
     }
 }


In the code each frame the state is playing we are MatchingTarget. HandPos(RED Sphere's transform) is the target and we are moving our Right Hand to it.

Now this is what happens. The Green Wire Sphere is suppose to be the right hand and we are matching target to The top of the of the blue barricade where the red sphere is but when the animation starts the Green Wire Sphere is out in front of the character not Where his right hand is. This causes the match target to not work at all

------------>GIF of the problem

I know this GIF is extremely bad quality it was recorded on my phone compressed in movie maker and made into a gif on a free website. BUT hopefully it will get across the problem im having better then images and text.

Thanks for taking the time to read my question, Hope someone can help ~Scott

or.png (54.5 kB)
loco.png (40.7 kB)
Comment
Add comment · Show 2
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 WeirderChimp · Jan 24, 2016 at 12:28 PM 0
Share

Please Note that if the "Jump" animation plays in the Locomotion Layer(base layer) it works perfectly. But my character isnt set up like that, thats why it must be in a separate override layer

avatar image Crossway · Jul 27, 2021 at 11:56 AM 0
Share

Hi. I have exactly same issue! It only works in the base layer! did you solve this?

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

43 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

Related Questions

Animator GetBehavior Question 0 Answers

Animator StateMachineBehaviour scripts are collapsed in inspector 0 Answers

Mecanim state that keeps last pose? 0 Answers

State Machine Behaviour OnStateExit doesn't call some time. 0 Answers

Creating Humanoid Animations in Unity 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