Wayback Machinekoobas.hobune.stream
May JUN Jul
Previous capture 12 Next capture
2021 2022 2023
1 capture
12 Jun 22 - 12 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
3
Question by silverbackAlex · Jan 31, 2019 at 11:44 PM · animationconstraintsorder-of-execution

When do constraints, like ParentConstraint and AimConstraint, evaluate?

I frequently employ the LateUpdate method on MonoBehaviours to locate or modify animated Transforms, after their animations have been evaluated. This works with both Timeline and Mecanim state machines, and has any number of uses; such as temporarily pinning props to character's hands, or offsetting the rotation of a character's bones.

I have recently taken to using the AnimationModule's new Constraints, such as ParentConstraint and AimConstraint. They're fantastic, but I have just discovered that they do not evaluate in time for their output to be used in LateUpdate. If I query the position of a constrained Transform in LateUpdate, it appears to return its position from the previous frame, not unlike querying an animated Transform's position in Update.

The effect is fairly catastrophic, in that the position of any Transform, with a Constraint anywhere above it in the hierarchy, is more or less impossible to find. Even using WaitForEndOfFrame to retrieve the value inside a Coroutine seems to yield an incorrect result.

When do Constraints actually evaluate, and is there any way to get the current or final position of a Transform being driven by a constraint? Constraints have been such a delight to work with otherwise, I would hate to have to stop using them. Any help would be much appreciated.

As an example of why one might need to know the position of a constrained Transform; I have a Spline system where a number of Transforms can serve as the vertices of a Bezier Curve. The resulting Spline can then be sampled at intervals, and its samples can be used to position other GameObjects, or the vertices of a LineRenderer, or whatever. We use it for cables, hoses, ropes and wires. This system works marvelously with normal animations, but once constraints are involved - such as constraining the nozzle of a hose to a character's hand - there's no safe method in which to sample the Bezier Spline, and the resulting samples become a jittery mess.

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

1 Reply

· Add your reply
  • Sort: 
avatar image
5
Best Answer

Answer by silverbackAlex · Feb 08, 2019 at 03:38 PM

For any future internet archaeologists who stumble across the same problem; I spoke to some people at Unity, and this appears to be a bug. Sampling the position of a constrained object in LateUpdate should yield the correct position, but there is some kind of problem with the execution order.

The devs are talking a look at it now, so likely it will be resolved in the near future. I'd welcome any alternative solutions in the meantime, but as the central mystery has been solved, I'll answer my original question:

At the time of this answer, there isn't currently a good way (or more accurately, a good time) to sample the position of a constrained object. As part of the AnimationModule, constraints are meant to be applied before LateUpdate, but some kind of bug is preventing that. The talented folks at Unity are currently investigating the problem.

Comment
Add comment · Show 3 · 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 AubreyH · May 01, 2019 at 06:12 PM 0
Share

Thank you very much. I am currently doing some I$$anonymous$$ using IAnimationJobs, and have a similar problem - the constraints don't see to react to the changes in transforms that are manipulated at all. If this is being fixed, I guess I just have to wait?

Did you find any way to force an extra update/evaluation of the constraint system manager?

avatar image silverbackAlex AubreyH · May 01, 2019 at 08:30 PM 1
Share

I'm told that update problem is fixed in "2019.2.0a11", so hopefully the change will be reflected in the "2019.2" release:

"Animation: Constraints are now evaluated before LateUpdate script (1123107)"

I didn't find a way to force an update, unfortunately. If you're not worried about making stable builds in the short term, you could try using the latest 2019.2 alpha, until the update.

Hope that helps!

avatar image ModLunar silverbackAlex · Jan 20, 2020 at 06:44 PM 0
Share

Thank you so much for the information, I am that future, grateful internet archaeologist haha! Hope your problems with this are all better now :)

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

259 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 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

Parent and rotation constraints are influenced by sources whose weights are set to zero 2 Answers

Can I make animations snap to a frame? 1 Answer

How to select an animation clip by index number? 7 Answers

How to move hips in Unity Animation Rigging IK 0 Answers

How to play character animation after bone deparent? 2 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