#### Howdy, Stranger!

It looks like you're new here. If you want to get involved, click one of these buttons!

# Sporadic rotating with negative angles

Posts: 9Member
edited 8:08AM
Using the Rotate to Angle behavior to rotate to a negative angle actually causes the actor to rotate non-stop. That's in most cases, anyways. This came up as I was using the "vectorToAngle" expression to make an actor rotate to the touch location. There's an easy fix of just adding 360 to the result, but it took me about 30 minutes to figure out the problem and fix it.

• Posts: 1,058Member
Actually, that is a new "feature" to 0.8.x. If entering a negative angle degree value in 0.7.0, it would convert it to the positive angle equivalent. Also, I think it 'moduloused' the value by 360 to ensure the value was always between 0 and 359.

And by feature I may mean bug unless that is what they intend.
• Posts: 1,058Member
It looks like it still converts the negative to a positive angle but sporadically behaves differently (i.e. sometimes it doesn't stop like you say).

Also, if an actor was at 0/360, if I put in 0 (or 360 that gets converted to 0), in 0.7.0 it would give me one full controlled rotation. Now a 0 yields no rotation.

I'd like to see some easy way to get a single controlled rotation now...
• Posts: 1,303Member, PRO
toggle between 360 and 0?

when 0 enter 360 when 360 enter 0 .. wouldn't that work?

also, if you use an angle data type i think it does the modulus for you, but i could be wrong.
• Posts: 1,058Member
It does do the modulus for you, so if you put in 360, you get 0. If you put in 359 to fake it (from 0) you get -1 degree of rotation instead of 359 degrees of rotation. Much different than in 0.7.0.

It was programmed to take the least "resistive" (if you will) path.

You could put in two "Rotate to Angle" one to take you from 0 to 180 and the next to take you back to 0 from 180 but then if you have them at the same execution level, no guarantee what order they run in so you have to delay one a fraction of a second and you get a hiccup in the rotation.

Seems like another boolean option on the "Rotate to Angle" for whether or not to perform modulus on the angle entered would be neat (thus if you turned off the feature, you could put in 720 degrees to get two exact rotations). They could call the boolean "Normalize Angle?" or something.
• Posts: 122Member
Had to comment.... I love being able to search the forums and find answers. Buzermali, you are the man. Thanks for sharing.
• Posts: 56Member
Hi:

Did anything ever come of this? I would like to rotate an object 360 degrees in place as a response to someone touching it.

it seems like being able to specify direction (and not leave it to the current 'shortest path' logic) and to specify rotation that goes beyond 360 degrees (multiple rotations) would be key to making this work.

Any thoughts chefs?
This discussion has been closed.