4

Is it possible to get vector of the x or y axis of face's normal orentation?

I know it's possible to get z axis of face's orientation like this

bpy.data.objects["Cube"].data.polygons[0].normal

However, I can't find a way to access x or y axis vector of normal orientation.

An expression like bpy.data.objects["Cube"].matrix_world (this express object local orientation) is also ok.

If these is no direct access, is these a way to calculate it?

Sorry for poor English

Lukasz-40sth
  • 3,062
  • 7
  • 19
  • 30
Giggle
  • 71
  • 3

1 Answers1

3
obj = bpy.context.active_object
obj.data.calc_tangents()

print(obj.data.loops[obj.data.polygons[0].loop_indices[0]].tangent)
print(obj.data.loops[obj.data.polygons[0].loop_indices[0]].bitangent)

I could find a solution by myself. Thanks!

Giggle
  • 71
  • 3
  • For some reason when I tried this; I get: RuntimeError: Error: Tangent space can only be computed for tris/quads, aborting on this line obj.data.calc_tangents() – Shiasu-sama Dec 20 '21 at 09:06