Christoph Müller
Christoph Müller

Reputation: 523

map degrees to 0 - 360 in python

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

For example:

Is there an easy solution? Maybe in mathutils?

best, chris

Upvotes: 22

Views: 22134

Answers (1)

juanchopanza
juanchopanza

Reputation: 227390

You can use the modulo operator % for this:

>>> print -10 % 360
350
>>> print 760 % 360
40

Upvotes: 52

Related Questions