Help Interpolating Between Vectors in Character Blueprint
Really quick background: I'm basically trying to achieve something like this - Procedural IK Leg Animation
So far, I've managed to get to this point. (Please ignore the broken knees and orange guy at this point, I'm only focused on animating the IK foot targets right now and working out the kinks before applying this to a real model.)
What I'm basically doing is performing foot raycasts and using them to drive two sets of vector variables: Rest Position and Current Position. The Rest variables are anchored to the character root. Meanwhile the Current Position is used directly as the IK Target for the feet (each foot has its own). These Current Position variables are driven by the Rest ones but remain in place until a distance threshold is reached between the Rest and Current vectors.
Once that distance threshold is reached, ideally the Current Position would interpolate toward the Rest vector position with some kind of curve or arc in the Z axis. If that happened, then the character would plant his foot, keep it there until the Rest position was a certain distance away then smoothly raise it, interpolate it toward the updated Rest position, lower it back into place, and basically take a step.
However, the setup I have currently just causes them to pop into their new position so the character basically just 'shuffle pops' around.
What I'm trying to figure out and could use help with is how to correctly set up the smooth interpolation between Current and Rest positions once the threshold is reached. I've tried fiddling with VInterp To but don't know if that's what I should be doing or how to make it work in this context. Any help would be really appreciated.
I'm personally a sucker for doing this kind of interpolation manually, by using a float to keep track of "time" of the interpolation. In the tick you increase the float with delta time until it reaches its max.
Essentially this as long as Time is less than EndTime:
Time += DeltaTime;
Interpolation = Time / EndTime; // 0.0-1.0
Then in the tick you do something similar to this:
Direction = EndPosition-StartPosition;
InterpolatedPosition = StartPosition + Direction*Interpolation; // ground plane
InterpolatedPosition.Z = InterpolatedPosition.Z + GetCurveValue(Interpolation); // height
You can create a custom curve asset in the content browser to use for that last part, or do a mathematical arc.
You can probably use the LERP functions to achieve similar things.
Follow this question
Once you sign in you will be able to subscribe for any updates here