2
$\begingroup$

I am trying to create a cylinder which is rotated 90˚ on the Y axis using, but the cylinder is over rotating to 5156˚.

Why is the cylinder over rotating and how can i rotate it only 90˚ ?

import bpy

object_size = 64.0
sce = bpy.data.scenes
for x in range(-4, 4):
    for y in range(-4, 4):
        for z in range(-1, 1):

            bpy.ops.mesh.primitive_cylinder_add(
                                location=(x, y, z),
                                rotation=(0, 90, 0),
                                radius=1.0/object_size,
                                depth=1,
                                vertices=8)

This is what the rotated cylinder looks like from the side.

enter image description here

$\endgroup$
6
$\begingroup$

When accessed via Python, all angles are in radians, not degrees.

rotation=(0, 90, 0),

If you want to write in degrees for convenience, you can use math.radians eg

rotation=(0, math.radians(90), 0),
$\endgroup$
  • $\begingroup$ or math.pi/2 which is the same as 90 degrees. $\endgroup$ – Mutant Bob May 29 '14 at 15:16

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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