0
$\begingroup$

Want to render a character in different direction using scripts, set the character standing on a plane, and use the code like following:

for i in range(0, 8):
    model.rotation_euler = (0,0,2 * pi * i / 8)
    bpy.ops.render.render(write_still=True)

But in rendered image the character is lying on the plane, why is that?

$\endgroup$
0

1 Answer 1

0
$\begingroup$

Update your scene using bpy.context.scene.update() and you should get the result that you expect.

So your code should look like this:

for i in range(0, 8):
    model.rotation_euler = (0,0,2 * pi * i / 8)
    bpy.context.scene.update()
    bpy.ops.render.render(write_still=True)
$\endgroup$
2
  • $\begingroup$ I tried this, but didn't work $\endgroup$
    – HSJaaa
    Oct 24, 2018 at 1:47
  • $\begingroup$ I solved the problem. It might have something to do with local axis and global axis, change the code to model.rotation_euler = (pi/2,0,2 * pi * i / len(direction)) solve it $\endgroup$
    – HSJaaa
    Oct 24, 2018 at 3:54

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .