Procedural Quadruped (IK) Animation

I’ve been stumped on this for the longest time.
To put it simply I’m looking to get a end result like to this:

I’m currently using base 4.26. I’m aware of power IK and control rig , but I can’t manage to set that up without breaking anything.

And?
You didn’t really ask us anything.

Also, please note that a spider is not a quadruped.
Movement is very different between what you are showing and a quadruped, despite what you show having only 4 legs.

If you are stumped on logic, look into Arduino spiders. I’m sure you can get resources on that, being essentially the “entry” level robotic question.

If you are stumped on engine… then 2 things, 1) tell us what you have tried. And 2) control rig is nothing to spit at…

I have tried many things, I thought I would save time skipping what doesn’t work, I’m sorry.
I suppose I could try explain my most recent attempt:
so I have it where the end of each leg uses world space ik (being done with the simple 2 bone ik),
1-in the event graph there is a function that I run once for each leg
2-the function checks the distance on how far the leg has moved
3-if the leg need to move it should lerp back to its normal position

Or at least that’s what I thought would happen, instead what happens is it drags the legs just out side the ‘move distance’ (I’m not sure how to refer to the function that dose this, the second one).
I know why this happens I just don’t understand how I can solve it.
What I think is happening is that while it is moving it, it still runs the check, and I kinda just need it to ignore that check until it reaches the intended ‘start position’. but I don’t know how to do that cause if I remove the check then nothing moves at all

Sorry if its difficult to understand its 6am here and I haven’t gotten any sleep.
let me know if you want me to to clarify further

Ok so. 2 things to start.

IK on its own is - as you discovered - essentiilly always on.

Procedural movent can either be reactive (like ik) or active. You need to pick one to know how to go about it.

For IK, while the check is on, the object is adjusted continuously.
In a walking cycle this basically results in skiing like animations.
To make it work with a walk cycle, you use animation curves.

For procedural animations instead of using any animation at all you use values/variables.

A thought example:
Every tick you check a trace of 2cm. If no hit, you lower the leg by some value.
Once you reach a hit, this stops happening.

This works for animating downwards. So you need a system to bring it back up.
Once it’s been brought back up, the system would automatically take over again.

Introducing “active” or “reactive” motion is more complex.
You have a speed driven by velocity that you need to constrain the movement to
(Like I said, look at arudino stuff for how this usually happens).

Now in engine there’s much much easier solutions to get the legs to go up and down.

First, make IK bones for all the legs.
Second. Always trace from the top of the leg to the floor and move the IK bone to connect with the floor.
Take care to convert everting from world to local - floating pint is important.
Third, make the legs reach the IK based on an alpha value. Fourth, cycle the alpha value up and down to get the motion going. Fifth figure out how to do it programmatically…

I really appreciate you offering your help, but I’m having a hard time understanding.

I feel it might be necessary to mention that I don’t have a animation for this. I was planing to make it mostly procedural (I’ll have to figure out how I’ll solve problems like jumping and falling latter with animations).

If it helps this is the main chunk of my animation system.
I might be doing this completely wrong, or maybe one little thing is off.

sorry about the mess, I went thor alot of variation and I don’t have any version control set up yet.


Look at your alpha values in the last image… and re-read what I write at the end?

Re your setup.
It’s kind of horrible in terms of accuracy. But you can circumvent most problems by setting the vector array default values.

The issue is that vector array > Get 3 may get something that doesn’t exist - crashing.
The default value would prevent that most of the time unless something alters the array.

Second.
The setup is obviously using a wrong trace. The trace should be derived from the original position of the leg - usually with a dedicated socket.
Get socket location, add X amount in Z to trace to.
That should get your legs to not be at 0,0,0.
I do see an array of names there… so the other option is that the conversion math is incorrect and returning non-valid or 0 vectors?

Third.
In the setup you have going leg start is updated every tick ? Guessing as you didn’t actually share the function.
If that’s the case, then you can’t really expect it to cycle up and down since UP was just changed.

Suggestion: for Up, take the “pelvis” bone of the mesh Z and plug it into the starting position all the time…

To loop the leg alpha you can use a sine function based on time and affected by speed.

I agree my set up is awful, I not sure what the best way of doing this would be it would make my life so much easier if there was a video tutorial for this, but all I can find are peoples finished products, and 0 guides on how to produce something like this.

In my experience change to alpha to anything but 1 make the IK ‘less responsive’, seeting it so 0 makes it just not do anything. I don’t understand why you would need to ‘disable’ ik mid walk cycle (referring to the object moving, again there is no animation make for this).

I did have a version previously that seems like it should work, but it crashed every time. Am I doing my vectors wrong? How should I do my vectors?

I’m not sure why the preview isn’t working but when play testing it seems to work fine.

if your talking about the line green float line, that is delta time.
I uploaded the function to a website that is like paste bin, but its made for ue4 blueprints.
So this website lets you see ue4 blueprints in a web browser so you can shear it with other people.
In case you missed it, here it is again.

Thank you for your patience as I can imagine this might be frustrating, I really appreciate you offering your help.
it might be a lot of me to ask but would you be able to put together a example and show me what I’m doing wrong based on that?

If you remember about it in a week. I’m on 3 different deadlines currently. Just don’t have the time to play with the editor atm.

Well that makes 2 of us, my apologies. I know how it feels.
Did you mention that before, I’m only getting this now?

Hadn’t mentioned it prior, but it doesn’t change much…

Checking the BP code thing you shared.

Keep working, keep this updated. I can probably film an example by the weekend.

Going by what is on the link - yea it crashes.
Any time there is No Hit. There is also no Hit Data to make calculations with.
Start by only running the rest of the code if the Hit is valid.
The rest looks OK-ish. Maybe too complex.

With IK in general it’s better to keep all instructions at a bare minimum, particularly when using BP, since it’s a lot slower to process per frame compared to cpp.