20

is it possible to map a value of rotation to be inside the range of 0-360 degrees?

For example:

  • a angle of -10° should be 350°
  • a angle of 760° should be 40° degrees?

Is there an easy solution? Maybe in mathutils?

best, chris

Christoph Müller
  • 483
  • 1
  • 5
  • 16

1 Answers1

47

You can use the modulo operator % for this:

>>> print -10 % 360
350
>>> print 760 % 360
40
juanchopanza
  • 223,364
  • 34
  • 402
  • 480