Download

Rotate Actor by amount (question)

Hi,

i came up with this system / function to rotate my actor by a specific amount in degrees over a certain amount of time (e.g. turn around 180° over 3 seconds):

Function using RInterp to Constant:

Macro thats putting the function in a loop until the desired angle is achived:

And this is how i trigger it for testing:

Everything is working fine so far but im not sure if its save to use the delay 0 node?
If i remove it the rotation is instant and pluggin in delta seconds as delay increases the time neccesary for the rotation.
And i wonder how i would achieve the same in c++.

Do you think it’s okay to use this (for now) or would it be better to drive it via event tick?

Thank you

Regards

You might want to do this in the Tick, as it’s normally a function based on multiple ticks.
That’s why you have to pass the DeltaSeconds (cause i tick could be delayed with an FPS drop/lag, so the delta time increases to compensate that).

If you don’t want to use the tick, you should think about a TimeLine and create a float that goes from 0 to 1. That can be used in a LERP instead of INTERP.

Alright i will think about an alternative once i finished my prototype.
Do you think i will encounter major problems if i leave it as it is for now?

Thanks

I guess? I mean, Tick is ticking in an interval controlled by you Game. Means if it lacks, the Tick will lag.
That’s why you have the DeltaSeconds.

Let’s say the Game ticks every second (which is way slower than it actually is, but easier for the example).
That means DeltaSeconds is 1. Cause 1 second between each tick.

So if you now have a lag that stops the game for. 15 seconds or so (pretty long, i know), then DeltaSeconds
is 15. This means, DeltaSeconds can be used to compensate the lag.

If you know use a weird, infinite loop like construct with the Delay, then it might result in totally different behavior
than you expect. That’s why I would use the Tick.

Have a boolean and a branch in the Tick. When the Boolean is true, you start the rotation node you created (without the Delay!).
If the Rotation node is finished, you let it set the boolean to false, and it will stop rotating.

Ok thanks for the clarification. I broke it somehow anyway so its no longer working :slight_smile: