Hey there,
Apologies for the delay. I took a look at all the older posts, questions, and this one here, and I’ll do my best to highlight a workflow I would suggest.
What if I create a HelperActor with a UStaticMeshComponent, attach that HelperActor to the actor that owns the Control Rig, and then pass the mesh’s location into the Control Rig? That way, ABP won’t get replaced, we don’t have to bake anymore.
Yes, this is a workflow that you could setup to do this, but it could be much simpler than having a component. At the end of the day, you can have the position you want sent directly to your control rig. Now this is dependent on a few things, and I might be missing something in your setup, but in general, you can have a sequencer file play animation, and that can play through a control rig to handle look at. You don’t have the sequencer contain the control rig; it lives in your animbp.
The reason I bring this up is this statement made here: That way, ABP won’t get replaced, we don’t have to bake anymore.
If you have a control rig in your sequence file, it will replace the animbp. This doesn’t mean that you can’t have a control rig in your animbp for dynamic runtime things like look at, but it does mean that for runtime it is better to have baked your non-dynamic animation down and not have the control rig running in sequencer.
Before I go into the workflow I’ll suggest, I’ll address your above suggestion with a component:
I believe the reason your code is not working is the call to UControlRig::FindControlRigs. It uses a TObjectIterator to iterate through every control rig in the editor and pie, but not at runtime. If it did work in the game, it would also be highly inefficient. To do what you want, you would probably need to use the ControlRigComponent. It’s a component that can control a skeletal mesh on an actor, but not through the animbp.
For the workflow I would suggest:
Typically, we use the animbp to pass data to the running control rig. I would have some position data that the control rig can listen for, passed through the animbp. That could come from an actor, it could be raw hand-keyed information, or driven from an external source. I’ve recorded a video and attached it here as it might demystify some of the setup as well.
- First you would have your actor
- That has a skeletal mesh an animation blueprint in it
- The animbp has a default slot in it to play the sequencer animation,
- The animbp and a control rig node after the default slot to play modifications to your pose. (In the example I give, look at)
- The control rig node points at your control rig.
- In the control rig make sure you have a control that you want to drive inside of it.
- Make sure that if you want to pass world position coordinates, you use the FromWorld node on the transform data of the control that you want to drive.
- Expose the control as a pin for the control rig on the animgraph node in the animbp
- Hook up a variable that we’ll drive from an external source.
- In your animgraph on blueprint update, pull the transform data or whatever you like really as long as it’s something your control rig can use from your actor.
- In Sequencer, make sure to set your animation mode on your actor as the animblueprint mode and that your actor is using the correct blueprint.
With this setup, you should be able to ferry any information from the world or sequencer to the control rig to the anim graph and play animation on the character at the same time. (Note: in the video I post, there is a bug with play animation because of new experimental anim mixer being on), If you like, I can share these assets with you in a default project, all set up if you need.
The key pieces of information to note:
- You can drive control rig information from the animbp by exposing controls.
- Please keep in mind that if you use world position information, you need to convert that position to rig space using the ToWorld node.
- In sequencer, you can animate and then bake down using a layer control rig if necessary. But it might be better to use LinkedAnimations. We don’t have documentation for this, but there are some user tutorials on EDC that you could use.
- Use the actor blueprint to ferry data from sequencer that you want to key through to the control rig.
Dustin