What could i use to add a value to a rotator variable

I am getting stuck because i am not able to add a rotation value to the rotator variable i am using What could i use to get the same effect? I am trying to rotate an object using ‘add local rotation’ node, only a certain amount until it hits a certain number using a forloopwithbreak node in blueprints.

You can use a Lerp(Rotator) node to alter the rotation of an actor, from a rotation to a rotation. The trick is it’s easiest to use when you have a stable start and finish. I have a chunk of Blueprints that use a timeline to accomplish this:

The timeline in this case is only .15 seconds long, and its output goes from 0-1:

Nice thing about timelines is they just play, no need to slap a tick node on them, you just fire and forget. And you can have the curve ease in and out, if you wanted acceleration/deceleration for your rotation.

But if you wanted to have a steady change regardless of values, you’d have to do some math to change the playback rate of the of the timeline (there’s a node for that), but it can be messy.

You could also do something with the TempCounter = Event Tick Delta + TempCounter, then use TempCounter / DesiredTimeToTransition, with a check of if TempCounter>=DesiredTimeToTransition = Break the loop, set the final rotation to desired final rotation). Didn’t test but something like:

There’s a ton missing from this, like resetting the counter, setting your rotation variables, setting the desired time to rotate, etc… but as a starting point should point you in the right direction.

Cheers!

I use the event tick similar to what i think you’re asking.

tick.png

sidenote -The above blueprint is a perfect example of a rotating sun. Attach this blueprint to a movable directional light and bam simple day night cycle.

The problem i am having is where i am trying to get it to break the loop once it has hit a certain number in the y axis rotation. But when i run it through the == operation nothing happens even after it has reached that number. What i thought it might be is that it was resetting the variable after every time through, so i wanted to add its self after the rotation to the rotation constant so i would be able to get it to stop and there are no ways that i have found to have that happen.

I ran into a similar issue and my solution was to create a pair of functions that convert a rotator into a vector and then back again. I used vector addition inbetween the 2 functions and it gave me to resulting rotateor that I was looking for.

Comparing two vectors or structs of floats using == is almost guaranteed to fail at all times due to the limited precision and rounding errors of floats. You should instead use a min or max value, and compare it to your current value using a <= or >= operator.

Hi ,

This is an archived post from pre-release. I am closing this thread as outdated. Have a great day!

Hi awilliams1701,

This is an archived post from pre-release. I am closing this thread as outdated. Thank you and have a great day!