0
$\begingroup$

I have two imported object that were alligned with the axes and then rotated. One was initially pointing upwards (0,0,1) and one forwards (0,-1,0). I now wonder how I can determine the new normal direction after rotation? I tried

v = mathutils.Vector((0,-1,0))
print (v.rotate(ob.rotation_euler))

but it did not work. enter image description here

$\endgroup$
2
  • $\begingroup$ When you say that "it didn't work", do you mean that it does not give you the result you were expecting or does Blender raise an exception in the script you're running? $\endgroup$
    – Robert Gützkow
    Jul 11, 2022 at 12:51
  • $\begingroup$ All I get is "None" $\endgroup$ Jul 11, 2022 at 14:56

1 Answer 1

2
$\begingroup$

The issue is that v.rotate(ob.rotation_euler) modifies the state of the vector v, but does not return a value. Instead of using print(v.rotate(ob.rotation_euler)) you can modify the rotation first and then inspect the value through print(v).

import bpy
import mathutils

ob = bpy.context.object
v = mathutils.Vector((0,-1,0))
print(f"vector before: {v}")
v.rotate(ob.rotation_euler)
print(f"vector after: {v}")
$\endgroup$

You must log in to answer this question.

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