1
$\begingroup$

I tried to add driver to Sphere's RotateX and link it with Cube's LocationX.

However, as shown in the image below, the driver value is 4.651, but the Sphere RotateY is 266.

enter image description here

The value of the driver will be regarded as radians without permission.

I created and tried the following Expression and it worked correctly, is this method recommended by Blender?

var * (3.1415/180)
$\endgroup$
3
  • 1
    $\begingroup$ I don't know why it uses radians here, as it displays degrees, I guess underneath the units system it uses radians and this must be what drivers act on. It is quite annoying and unintuitive. $\endgroup$
    – Moog
    Nov 29, 2019 at 21:17
  • 1
    $\begingroup$ @Merlin scene > units > rotation is set to display degrees by default. (Which makes perfect sense, since multiples / fractions of 360 is easier to visualize than those of pi) The standard python math module is available to drivers. Using sin(value) will give the expected result with a radian input value. Same with numpy. No guessing needed, blender uses radians under the hood. Once this is known it's really not that difficult. $\endgroup$
    – batFINGER
    Nov 30, 2019 at 2:51
  • $\begingroup$ @batFINGER thanks, I don't have a problem with radians per se but with entering a value as a driver doesn't honour the units. If for example I enter a driver with #frame / 360, one would expect it to revolve at 1 degree per frame but it doesn't, in fact tests show it as deciframes per radian or something weird. I understand the technical challenge that it presents, but intuition would observe that units should be in the chosen system. $\endgroup$
    – Moog
    Nov 30, 2019 at 10:27

1 Answer 1

3
$\begingroup$

It's correct that the value is in radians. Blender uses radians for angles internally, since this is common practice for the calculation of trigonometric functions. The conversion to degree is only for display purposes in the user interface.

The same situation can be seen in the Python API. Assuming that you have an object named 'Cube' in your scene which is rotated 180° around the x-axis. When accessing the Euler rotation

bpy.data.objects["Cube"].rotation_euler.x

you will see that it returns 3.1415927410125732 which is a rough approximation of $\pi$.

This was previously asked on the bug tracker in T29797.

$\endgroup$
6
  • $\begingroup$ Maybe a mention or picture of scene > units > rotation $\endgroup$
    – batFINGER
    Nov 30, 2019 at 2:20
  • 1
    $\begingroup$ The displayed unit for the angles can be changed in Scene Properties > Units as shown in this screenshot. However since this impact how the driver handles the value, I don't think this is really relevant. $\endgroup$
    – Robert Gützkow
    Nov 30, 2019 at 10:42
  • 1
    $\begingroup$ Since the math module is loaded for the driver expression (when Python restrictions are disabled) you can also use radians(var) if you want var to be treated as angle in degree and convert it to radians. $\endgroup$
    – Robert Gützkow
    Nov 30, 2019 at 10:47
  • $\begingroup$ '...rough approximation...' :) $\endgroup$
    – Robin Betts
    Nov 30, 2019 at 10:48
  • $\begingroup$ The unit can be changed\? Good to know. , The assumption to this question is that the values should match. if the unit is set to radians the values do ofcourse match, Matching expectation. Suggested as a visual aid re first paragraph above. $\endgroup$
    – batFINGER
    Nov 30, 2019 at 11:24

Not the answer you're looking for? Browse other questions tagged or ask your own question.