Add constraints to effectors and baking constrained animation?

Hi, I just started playing around with the Animation Rigging Package and I'm trying to see if I can use it to edit animations and animate characters from scratch directly in Unity instead of using Maya or Blender.

What I am trying to do at the moment is the following steps:
-Get effectors to follow an already existing animation
-Bake the motion of the effectors
-Have the bones follow the effectors baked motion

But I am stuck at the first step. Is there a way for effectors to be constraint to an animated skeleton?

As for the next step, I can probably just write a simple script that keys the effectors every frame, with the option to remove the constraint afterwards.

Here's a gif done in Blender that shows what I am looking to achieve.5509285--565189--EduardoAnimToolsTest.gif

If it is not yet possible, I would love to see this feature added in some way in the future.
Thank you for your time.

Hey, this is a perfect time to be asking these questions :)

In the 0.3 version of the package we are adding functionality for bidirectional motion transfer. All constraints can be baked down to the skeletal animation using the 'transfer motion to skeleton' context menu found on constraints in the inspector. On top of that some constraints support the transferal of motion to the constraint (a.o. TwoBoneIK). You can use 'transfer motion to constraint' to bake curves on effectors to follow and preserve an existing animation. After you have done this you can edit the animation my modifying the curves on the effectors/constraints. Finally, when you are done you can bake the everything back to the skeleton. This allows you to remove the constraint but still keep your modifications to the animation. This last step is optional as you could also keep your constraint with curves around for runtime.

I would like to point out that to enable the context menu's for the transfer options you need four things:

  • The animation you are editing is generic, it cannot be humanoid.
  • You have an animation selected in the animation window and are previewing this animation
  • You only have a single object selected in the hierarchy window (no multi-selection)
  • There is a valid setup with constraints, rigs & rigbuilder.

If you do not meet these criteria the options will be grayed out in the context menu of the constraints. More detailed information on what to expect and how it works can be found in the documentation:
https://docs.unity3d.com/Packages/com.unity.animation.rigging@0.3/manual/BidirectionalMotionTransfer.html

It can take a bit of time to wrap your head around the bidirectional motion transfer. Also choosing the right type of motion transferal for the job might take some experimentation. However, we have found both options to be extremely powerful as you get used to them. The features are brand new and please report bugs if you encounter any issues with these new workflows.

1 Like

Thank you @Jebtor for your clarifications. I was using Unity 2019.3 so I didn't had access to the 0.3 version of the tool. I got to test the Bidirectional Motion Transfer and the Auto Setup. Really great stuff! :)

I just have a few nitpicks/suggestions:
-While in Preview mode, when I add a constraint component and use the "Auto Setup From Tip Transform" the constraint won't update in the scene view until I un-toggle then re-toggle Preview mode.
-It would be nice for Empty Game Objects created by the Auto Setup function to have Effector shapes assigned to them by default.
-Is there a way to access the script for the the Bidirectional Motion Transfer so that I can add custom options to delete constraints (including relevant effectors) after baking constrains' motions to skeleton?

What I would love to be able to have is a similar animation workflow as what Richard Lico calls the animation sandbox in his GDC talk on Moss.
https://www.youtube.com/watch?v=u3CzLVpuE4k|start=2011

With what is in the Animation Rigging package at the moment it's already very powerful! Looking forward to the next updates.

Thanks for the suggestions, and yes, Richard Lico's talk is great :)

Regarding your suggestions. Unfortunately, we cannot automatically un-toggle and re-toggle preview for you as it may lead to loss of data from your preview state.

Toggling effectors would be nice and speed up workflows. There is a ticket somewhere on our backlog to do this. However, it might be a while before we get to this.

To your final point, all the code for bi-directional baking is present inside the package code as C# code. You could modify this to do exactly what you want. However, it might be better to write a custom separate editor to do this - so you don't need to maintain a custom version of the package. In the package we do not delete anything as it is hard to guess the user's intention. When this is the case it is better to stay on the safe side and be preservative.

I would also like to highlight that similar to writing custom constraints you can write inverse constraints for your custom constraints. This allows you to hook your custom constraints into the bi-directional workflow. The inverse constraints for the build in constraint live in the Editor/InverseSolve folder. A inverse constraint requires an IWeightedAnimationJob which inverts the constraints algorithm. Furthermore you need to define an OverrideRigConstraint with an InverseRigConstraint attribute to connect the inverse constraint to your regular constraint. I would like to stress that this workflow is pretty advanced.

1 Like

Hey I'm pretty excited about this baking feature. Are you guys looking to add humanoid support soon?

Hi,

Unfortunately, authoring humanoid character animation is not in our roadmap for bi-directional baking. While it doesn't mean that we won't support it eventually, I wouldn't plan anything around that.

As a workaround, you can try the FBX exporter (https://docs.unity3d.com/Packages/com.unity.formats.fbx@3.1/manual/index.html) to bake constraints back to a generic rig and then reimport that rig back as humanoid.

1 Like


When I try to export to FBX with some constraints in place it fails quite hilariously :smile:

Hi Ward_L,
I wanted to mention that yes indeed, you can have similar workflows as you referenced above. Here is a link to my new presentation at GDC 2020 Tech Art Summit where I elaborated more on how it works and can be used for creating animations in Unity.

GDC 2020: Freeform Animation Rigging, Evolving the Animation Pipeline

It would be great to hear more about how you are using these tools so please keep us informed about how it goes!

3 Likes

I am having some problem, I am using Two bone IK constraint. but "transfer motion to constrain" options are not showing. any suggestions.
using Unity 2019.4.10f and animation rigging package (0.2.7)

Bidirectional motion transfer is only available in version 3.0 and up.

Any news about the bidirectional motion transfer working with humanoid. Has it been added to the roadmap ?

3 Likes