How to smoothly rotate? Math problem?

Hi! Does anyone know how to smoothly rotate an object at a constant speed but with ease in/out?

I’ve tried using RInterpTo but its speed isn’t constant and it only eases out.

RInterpConstantTo looks promising but it offers no easing and therefore instantly starts and stops.

It’d be greatly appreciated if some math genius can come up with a solution to this, as this is a very common game problem and I’m sure it would help others too searching this forum.

Does it need to be cpp?

If not, then use a timeline in which you make a custom curve.
Output the rotation directly and just apply it where needed.

If in cpp… you can probably use a curve asset but it’s far more complicated than just a timeline.

Yeah, I am in C++ and I’d have no idea where to begin with using a curve asset, lol.

Try defining
UCurveFloat* Curve;

As edit everywhere.

You’ll need to Google ucurvefloat to pull in the correct header.

Theoretically, then.
You just GetCurveValue with delta time.
And once compiled in engine you should be able to select or create a curve asset.

Going from that to actually using it… not quite sure

Thanks, I’ll give it a whack. My target rotation is continuously changing (play control rotation) so this is going to be quite difficult to implement.

If it’s not network replicated… or even if it is possibly.

Use an animation curve and root motion.
(You can simply put the rotation via animation into the root bone)

The networking alternative would be to take that same rotation as a curve and use it to update the root bone rotation (commonly done for turn in place)