How do I move parts of the character via input?

Let’s say I want the arrow keys to move the hand of my character up/down/left/right

or if I want the head of the character to follow the mouse…

How would I do that? All I know is that I need working IK (which fortunately the base mannequin has) so the other limbs follow the one i’d be moving, but no idea on how to do the actual moving part.

Oof, not a lot of responses huh? Well I have investigated and found a way.

First off the method I’m using is based on this one How do I control character's arm with mouse in combat - #4 by unit23

But there was a lot of interesting stuff in this video that i’m not currently making use of https://www.youtube.com/watch?v=Hh4om_A7ufk

Those are basically all the ‘good’ data I could find about this, but the former was broken, it was using cast to bp_thirdperson from an animbp and I couldn’t find a way to make that work, so I did it a better way by casting to the animbp from the characterbp instead (this way it isn’t constantly checking for the value and instead just sends the value when it has changed)

So…

AnimBP Event Graph:

AnimBP AnimGraph:

Character Blueprint Event Graph:

And now one of the characters limbs rotates when I move the mouse (You need to set the bone in the transfor modify node and configure it to apply the rotation instead of ignore it).

Easy. I’m not sure if it’d be better to use an interface instead of cast here or not though, and i was feeling too lazy to translate the input stuff to the enhanced input system (but it’d be quite easy to just use IA_Look), also not sure if there might be a better way to share variables between multiple blueprints (although i suppose interfaces again could do it).

Edit: Here’s a practical example of it in use for procedural crouch (crouching without any specific animation or pose to do it)

I do believe it would be a lot more efficient however to pass the values to the control rig and then do basically the same thing from inside the control rig.

Here is a control rig equivalent:

Interestingly, within the control rig the axis are completely different from the animbp so i had to put the same numbers but on entirely different axis, I thought at first I had to set it to additive global but no, additive local was correct, the axis were the problem.

Anyhow the controlrig is probably a much more efficient way to do this, for one it’s nice to be able to do it all from just one node (amazing really), and there’s also the fact that the animbp route checks if you should be crouching on every anim update for every bone modified, whereas the controlrig just checks once if you’re crouching or not and only thinks about the bones if you are.

This is basically procedural animation.

Transform bone as you’ve done or control rig would be the ways to do it.

but rather than cast (basically on tick there) to the AnimBP, have the AnimBP cast to TryGetPawnOwner, on Init and then you can pull any values from your pawn on the blueprint anim update

1 Like

This topic was automatically closed 30 days after the last reply. New replies are no longer allowed.