Spaceship Interpolation using Add Local Rotation

Hello! I’m trying to add interpolation to my ships movement. Originally I just directly gave Add Local Rotation the yaw and pitch value, but now I want to smoothly interpolate it. This is the current setup I have. I realized through this I’m, using the Finterp sort of the wrong way since when the current reaches the target, the return is the target. How would I fix this to create smooth interpolation the ship?

I don’t think what you think is happening, is happening :stuck_out_tongue_winking_eye:

Your FInterp is in your event handler which resets the target, and it is called once (only) with each input event, so unless your multiplier is very high or the delta very large, you are never getting near the target.
The normal usage to interpolate is to set your target wherever and whenever appropriate (event handler, function, other(?)), and XInterpTo it in Tick, so that it will keep changing until it reaches the target.

PS:
Looking from a wider perspective, I am doubting you actually want to interpolate here. The normal use case is that you want to set a target and interpolate to it over time, and while you might want to set the target again before the first interpolation is done this would be an exception, not the norm, as it will be in your use case.
A Concrete example (but probably not a great one): third person game where when the player is not in motion the mouse will ‘Look’ but not turn the player until the difference of the look direction and character facing are beyond some threshold and then turn a whole 90 degrees (or 45, or whatever…), a so called ‘turn in place’. The constantly arriving mouse events change the look direction immediately (no interps), and check if the difference from the character’s facing should trigger a turn, if so it sets a target and that is all. The character facing is interpolated in Tick.

If you do implement actual interpolation here (i.e. fix the current interpolate a tiny bit this/that way when the event occurs) the ship will keep turning after the input is removed until it reaches whatever the target is, which does not sound like a fun game to play!

1 Like

Yeah I agree. After hours of playing with it, trying to get it to work, I also came to the conclusion I wasn’t 100% on what I actually was doing. :smiley: :gun:

If interpolation isn’t the way to go here, what route should I go? I guess my objective is to try and get the ship to be less “responsive”. Right now wherever the mouse moves the ship spins to point right at it, but my goal is to get it to feel more “floaty”. Really just have it so the ship doesn’t spin right away. I’ve found that interpolation works better with Set Relative/World Rotation, but can somehow get it to work a similar way with Add Local Rot?

You should still be able to achieve your goal by implementing the fix that the other distinguished gentleman has provided. But if you want the rotation degrees to be multiplies of 90, you can use timelines and gradually rotate your character as the time passes only once and only if the mouse has been moved enough.

However if the approaches that include thresholds are not what you’re looking for, you can just get the control rotation and plug it’s one axis into one of the axis of the set world rotation node (which pins should be connected together depends) and to make it less responsive, you can just add a short delay before this.

Ah, well you may want an FInterp after all, but may not need it or if you do will need to change how you are doing things (depending on your setup, and assuming I am actually understanding what you want now).

Assuming a 2D setup, if your ship is a Character you can abuse the CMC, even though a ship isn’t very character like (I do this with non-humanoid robots), turn off use controller rotation, turn on use controller desired rotation and set a desired rotation rate (last component is yaw).

No sure if floating pawn movement has analogs to that, but if your ship is a pawn and you are controlling everything ‘manually’, you will actually want FInterp, but using the axis values from mouse events will not be helpful, you will need to get the mouse location, subtract ship location and build a rotator from that, which will contain your target yaw for the FInterp (which is in Tick), something like:

Let us know how you go, or if I should ‘expand’ on anything above :slight_smile: