Download

Character IK foot (Rotation Method No knee bending)

I’ve been working on a ratchet project for a very long time and have stumbled upon the IK system. And i’ve been trying to think of all the possible and optimal solution. Even the easier way like Find look at rotation and getting angles from 2 vectors (In my case is From a socket location attached to the upper foot and to the impact point) I’ve tried to rotate it based on the angle of the surfaces, but i didn’t think about the different heights and stuff.

This is what i’m going for.

Currently No height differences

With Height Differences

Angled with the ramp but probably not determined by the angle from the normal.

Angled with the left foot but the right foot is still rotated when it’s on the flat part of the ramp.

Steeper Ramp but not reached the top flat part yet. (Pretty bad perspective ://)

Steeper Ramp on top.

Not really any height differences here but it still rotates to match the angle of the ramp which i don’t really see any solution to.

Running in the middle of the ramps

Skeleton Socket location Setup

1st Solution using Look at rotation.

Results from Look at Rotation (Bone had World space and Add existing)

Setting up Angle between Vectors.

Setting Degrees into the X axis (Bone is Rotating on the Y by X since i set it up like that)

Barely Rotates but the degrees does not seem to be correct.

Same Method but in the air it’s different.

Is there any optimal way to replicate something like this, i’m really hoping that someone can help me with this i’d be very appreciated.

I’m going to transform some of my node setup, since I am originally using this to drive the player’s rotation to match the floor rather than driving the foot to match the floor; so bear with me. I don’t see why this would not work for any component. In the case of a first person view, it will prioritize aligning the Z vector first but try to keep the X vector as close as it can. So the foot should always appropriately face forward.

Well, i kinda expected this from working with the surface normals.
It goes back 90 degress once it hits a flat floor. I want it to dynamically rotate the leg sideways so that the foot is on the flat part.


Traces hit the angled floor.

Hit the top part of the angled (Ramp) floor

This is what i want

What does the foot rotation look like if you zero out the bone. It may be that the bone’s z axis isn’t actually up relative to the floor space. Actually, if you can give me a screen shot of the UE4 skeleton asset scene with the foot bone selected (and widget set to local space (top-right of the viewport)), I’ll be able to tell right away what axis you need.

There’s a difference between rotation and move mode


Selection was set to local space

Sorry, I need the foot bone, not the leg bone.

Anyways…if this is local space, it looks like you have Z axis forward, X axis up, Y axis right. These might be rolled over on the foot bone but I digress.

Back in that snippet of blueprint, you need to change the “getForwardVector” to a “getUpVector”, and change the “makeRotFromZX” to a "makeRotFromXZ. The trace’s normal wire plugs into X (this is your bone-space Up) and the getUpVector plugs into Z (this is your bone-space forward). You may have to multiply the getUpVector by negative 1 because it looks like it’s pointing backwards.

I think it’s weird that we got different axis out of blender skeletons but oh well. (I have Y forward, but I tried to get X forward, Z up out of export options; didn’t help).

Oh, and your move and rotation widget’s axis are actually the same. And, to be honest, it looks like the world space widget.

Well…

It spins like crazy once it hits something

Aye I was worried something like that might happen. I’m going to test on my end before I respond this time. I’m thinking the foot bone needs a saved default rotation that the normal can then be added to so that it’s not adding to itself.