Setting Rot Value if negative

Hi I am trying to detect whether my float value goes over a certain value.

So here i’m checking my segment I am rotating if the current segment matches my value it then check to see if my Inner rot store is more than 360 if it is I want to reset it back to 0 and if it less than 0 reset it to 360, so it loops round on itself, although it wont work it just keeps going past -30 or above 390.

I am using the value inside a timeline.

This is how i get the value

This is how i set the value.

All i want is for it to loop around the float value and not increase over the value of 361 or decrease over the value of -1

Thanks

I have not checked all of your blueprints but if you want to have a value that cycle between 0 and 360, you could simply use the modulo operation, with 360 as the B value. https://docs.unrealengine.com/latest/INT/BlueprintAPI/Math/Float/__float/index.html

Its not so much I want to cycle I want to detect if the value goes over 360 and if it does reset it to 0 my issue is that my current process doesn’t allow for that.

Ok I though you wanted to have your value looping when reaching 360 (ex: 371 becoming 11).

2 things you may want to check:

  • I dont know when your Over360Clamp event is called so maybe double-check that.
  • It seems strange that your conditions are both using equals as true. The way it is right now, if your value is not changing between each call to your event, it would move back and forth between 0 and 360.

Good luck!

My Over360Clamp is being check every tick, and I wanted it to asoon as the player trys to rotate over the value of 360 it sets it to 0 and rotates from the value of 0

So this half fixed it it will now reset the rotation needs some more fine tuning but it works.

Hmmm, are you sure the modulo operation is not what you need? For example, if your value is 390, do you want it to become 0 or 30? If it’s the second one, then modulo would make your life much easier.

Cheers!