How do I add a FInterp to this?

I have a character that has additive twist animations in an aim offset for when the character is pointing in a different direction than the camera (yaw).

When the camera is in front of the character, I want the character to look forward, as in not twist, so you can get a better view of the character. I mean, why would you try to look at something behind your character and have your character look there too? I think most people, when panning the camera like that, want to look at the character, so the character should be looking straight ahead.

Anyway, I’ve set up blueprint scripts for this, and it seems to be working - but there is no interpolation between the character twisting, and not twisting.

This is what drives me absolutely crazy. I simply can’t get this FInterp node to do the thing I want no matter what I do. Either it’s completely ignored, or it only starts to jitter instead of interpolate smoothly. There was a certain point where I somehow got it to work one way, but not the other.

How do I use the FInterp node in this scenario, or any other more suitable node to interpolate between twisting and not twisting? I’ve tried many different takes on it, but nothing is working.

Here’s what it looks like now. I made variables out of the data used so that it’s easier to manage. Since it appeared the be such an abstract node, I thought it might be picky with its inputs, especially after getting all that jittering.

Here’s an earlier example that DID work, but only one way, and I simply have no idea why this only worked if I put the first setCharacterTwist AFTER the branch, but not if I put it BEFORE the branch.

I see you’re using CharacterTwist as input and output of the interp, that’s gonna end in tears…

With interp, you have two inputs

  1. Current actual rotation ( location etc ) - EDIT: just plug rotation of the capsule in there

  2. Where you want to go, a fixed point - keep that as zero or a fixed point you’re trying to reach

Then you use the output to set the rotation ( in this case ) or the thing you’re interested in.

Usually you would have a SetRotation node here, I’m assuming you have that elsewhere on tick. And it’s ok to set a variable and read that on tick, and then set the rotation.

But it’s not ok to use the variable as input and output :slight_smile:

Thanks for the reply.

I did find it very strange using the character twist as input and output. That was merely a snapshot of the closest I got to what I wanted.

I can’t use the capsule rotation for anything if I don’t have its value in relation to the camera’s rotation (delta rotator node). In that case the capsule’s world rotation will determine which direction and how much the character twists, which doesn’t look right.

Also, the target value in what I want isn’t always 0. The target value is only 0 when the camera is in front of the character, but if the camera rotates back to less than +/- 120 degrees again, the target value should be whatever below +/- 120 it’s currently at. So I can’t see this working at all without a branch that somehow swaps the current and target values when the camera is over the +/- 120 threshold.

No, I don’t have a setRotation node elsewhere on tick. I’m not sure what I would use it for in this case.

Here’s a video of what I’m doing, or trying to do:

^ Here you see result of that snapshot where I almost got what I wanted, but used the characterTwist as input and output, not being able to get it to interpolate smoothly back to a twist.

Sorry if I’m misunderstanding something here :slight_smile:

Also, to aNorthStar, the reason I’m not using rotators for now is that the animation blueprint is only asking for a float value, so I only need the yaw for this. I haven’t gotten into how rotators work in-depth, but that +/- 180 degrees has seemed to work for this specific scenario - it’s at 0 when camera is straight behind the character, which is what I want. The -180 to +180 transition in the front is rather snappy, though, but I would circumvent that with either turning smoothly the other direction or looking forward like I’m trying to do here.

… just to mention also… I think feeding floats and Finterp directly into rotators can lead to unusual outcomes because rotations have special handling in the engine (pitch +/- 90, yaw/roll +/-180 etc)… Ideally I’d keep everything in rotators, InvertRotator and RInterp and store it as a rotor too. Though Rinterp has flaws…but it can really work for most situations… and there is Qinterp if issues arrive)

Basically, you have to have these 3 factors to make it work:

  1. Input of the current actual rotation of the object you want to move ( actually sample it, it can’t come from a variable )

  2. Where you want to go. That can be 0 or 180 etc, but it has to be fixed. It’s ok you can change between 0 and 180.

  3. The output going to something which is controlling the rotation of the object you sampled in step 1.

Then it will work.

That example is also a bit jerky actually eh? I notice you dont’ need the do any math between the camera and capsule rotation, but you do need to know the camera rotation. Gimme a little while…

Ok here you go, not quite the same setup as you, and I have to do this ridiculour 90 degree slide to show the character movement, but it gracefully corrects then the camera is in front. This is tick:

I just have a bool to tell the character when to look left. But it’s the correction you’re interested in.

I have a function that decides what the interp target is going to be, just a bit neater:

And then this is my character looking away until the camera is somewhere in front:

301006-front.gif

Well that looks good :slight_smile:

Hi again! So sorry I left this hanging for so long. I spent a LOT of time experimenting further, almost giving up several times. I got it working in the style you made here, and it helped me understand Finterps a bit more :smiley:

I think I might have found the solution. I got the inspiration from setting up my character lean from this live training video here:

After setting that up, I realized (please correct me if I’m wrong or need to rephrase this) that you CAN use a variable as input and output, but it has to be a variable that has not yet been set at runtime.

So, for looking around, I started off by scrapping the Finterp for twisting/not twisting depending on camera angle in favour of a couple of range maps that would transition from +/- 120 to 0 degrees, instead of the default +/- 120 to 180 degrees.

Then, after I had that set up, I did that leaning thing seen in the video above, or something similar to it, and I tried to set that up for the twisting as well. It seems to work the way I have set it up in the blueprints below.

However, now I wanted yet another thing - to blend between a looking around twist and a turning around twist, if that makes sense. I think the right logic here was that when the character is idle, she will look around, and when she’s moving, she will instead turn the direction she’s moving in. I’m not going to pretend like I can explain it in detail yet - but it seems to work!

Here's what the twisting and leaning looks like now.

Character twist blueprint

Twist amount

Twist interpolation

Anim BP